diff --git a/.github/.github.csproj b/.github/.github.csproj index 124abb37..568bf7d5 100644 --- a/.github/.github.csproj +++ b/.github/.github.csproj @@ -1,6 +1,6 @@ - net6.0 + net8.0 False diff --git a/Directory.Build.props b/Directory.Build.props index e0fb993e..28593c00 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -20,6 +20,6 @@ - + \ No newline at end of file diff --git a/build/scripts/CommandLine.fs b/build/scripts/CommandLine.fs index b6f04861..ae8a06b8 100644 --- a/build/scripts/CommandLine.fs +++ b/build/scripts/CommandLine.fs @@ -28,18 +28,18 @@ type Arguments = interface IArgParserTemplate with member this.Usage = match this with - | Clean _ -> "clean known output locations" - | Build _ -> "Run build" - | Test _ -> "Run all the unit tests" - | Integrate _ -> "Run all the integration tests " - | Release _ -> "runs build, tests, and create and validates the packages shy of publishing them" - | Publish _ -> "Runs the full release" + | Clean -> "clean known output locations" + | Build -> "Run build" + | Test -> "Run all the unit tests" + | Integrate -> "Run all the integration tests " + | Release -> "runs build, tests, and create and validates the packages shy of publishing them" + | Publish -> "Runs the full release" | SingleTarget _ -> "Runs the provided sub command without running their dependencies" | Token _ -> "Token to be used to authenticate with github" | Commit _ -> "Commit hash to be used to fetch the logging spec" | CleanCheckout _ -> "Skip the clean checkout check that guards the release/publish targets" - | UpdateSpec _ -> "Updates the logging spec" + | UpdateSpec -> "Updates the logging spec" | PristineCheck | GeneratePackages | ValidatePackages diff --git a/build/scripts/scripts.fsproj b/build/scripts/scripts.fsproj index 52203474..dbe08c22 100644 --- a/build/scripts/scripts.fsproj +++ b/build/scripts/scripts.fsproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 false diff --git a/docs/docs.csproj b/docs/docs.csproj index 124abb37..568bf7d5 100644 --- a/docs/docs.csproj +++ b/docs/docs.csproj @@ -1,6 +1,6 @@ - net6.0 + net8.0 False diff --git a/examples/Elastic.Extensions.Logging.Example/Elastic.Extensions.Logging.Example.csproj b/examples/Elastic.Extensions.Logging.Example/Elastic.Extensions.Logging.Example.csproj index 49fdd90a..71118347 100644 --- a/examples/Elastic.Extensions.Logging.Example/Elastic.Extensions.Logging.Example.csproj +++ b/examples/Elastic.Extensions.Logging.Example/Elastic.Extensions.Logging.Example.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 latest enable diff --git a/examples/Elastic.Serilog.Sinks.Example/Elastic.Serilog.Sinks.Example.csproj b/examples/Elastic.Serilog.Sinks.Example/Elastic.Serilog.Sinks.Example.csproj index 782ccf14..0ac3c7c3 100644 --- a/examples/Elastic.Serilog.Sinks.Example/Elastic.Serilog.Sinks.Example.csproj +++ b/examples/Elastic.Serilog.Sinks.Example/Elastic.Serilog.Sinks.Example.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 enable enable diff --git a/examples/aspnetcore-with-extensions-logging/Program.cs b/examples/aspnetcore-with-extensions-logging/Program.cs index 3595429e..9720b118 100644 --- a/examples/aspnetcore-with-extensions-logging/Program.cs +++ b/examples/aspnetcore-with-extensions-logging/Program.cs @@ -17,16 +17,13 @@ builder.Services.AddControllers(); builder.Services.AddEndpointsApiExplorer(); -builder.Host.ConfigureLogging((_, loggingBuilder) => -{ - loggingBuilder.AddElasticsearch(client.Transport, log => +builder.Logging.AddElasticsearch(client.Transport, log => { log.Tags = new[] { "debug" }; }, channel => { channel.ExportResponseCallback = (response, buffer) => Console.WriteLine($"Written {buffer.Count} logs to Elasticsearch: {response.ApiCallDetails.HttpStatusCode}"); }); -}); var app = builder.Build(); app.UseAuthorization(); diff --git a/examples/aspnetcore-with-extensions-logging/aspnetcore-with-extensions-logging.csproj b/examples/aspnetcore-with-extensions-logging/aspnetcore-with-extensions-logging.csproj index f259b915..9c9e7cbd 100644 --- a/examples/aspnetcore-with-extensions-logging/aspnetcore-with-extensions-logging.csproj +++ b/examples/aspnetcore-with-extensions-logging/aspnetcore-with-extensions-logging.csproj @@ -1,7 +1,7 @@ - net6.0 + net8.0 enable enable aspnetcore_with_extensions_logging diff --git a/examples/aspnetcore-with-serilog/AspnetCoreExample.csproj b/examples/aspnetcore-with-serilog/AspnetCoreExample.csproj index 59afdc23..9e8ba691 100644 --- a/examples/aspnetcore-with-serilog/AspnetCoreExample.csproj +++ b/examples/aspnetcore-with-serilog/AspnetCoreExample.csproj @@ -1,6 +1,6 @@  - net6.0 + net8.0 false false diff --git a/examples/console-with-extensions-logging/console-with-extensions-logging.csproj b/examples/console-with-extensions-logging/console-with-extensions-logging.csproj index f630a65e..b0e4e524 100644 --- a/examples/console-with-extensions-logging/console-with-extensions-logging.csproj +++ b/examples/console-with-extensions-logging/console-with-extensions-logging.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 latest enable diff --git a/examples/playground/playground.csproj b/examples/playground/playground.csproj index 398b55e1..bf0cdf78 100644 --- a/examples/playground/playground.csproj +++ b/examples/playground/playground.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 enable enable diff --git a/global.json b/global.json index c317b002..56135386 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "6.0.302", + "version": "8.0.302", "rollForward": "latestFeature", "allowPrerelease": false } diff --git a/src/Elastic.CommonSchema/Serialization/EcsJsonContext.Generated.cs b/src/Elastic.CommonSchema/Serialization/EcsJsonContext.Generated.cs index 8629bf80..b954e29c 100644 --- a/src/Elastic.CommonSchema/Serialization/EcsJsonContext.Generated.cs +++ b/src/Elastic.CommonSchema/Serialization/EcsJsonContext.Generated.cs @@ -6,7 +6,7 @@ /* IMPORTANT NOTE ============== -This file has been generated. +This file has been generated. If you wish to submit a PR please modify the original csharp file and submit the PR with that change. Thanks! */ @@ -63,5 +63,7 @@ namespace Elastic.CommonSchema.Serialization; [JsonSerializable(typeof(Vlan))] [JsonSerializable(typeof(Vulnerability))] [JsonSerializable(typeof(X509))] +[JsonSerializable(typeof(LogEntityJsonConverter.LogOriginInvalid))] +[JsonSerializable(typeof(LogEntityJsonConverter.LogFileOriginInvalid))] [JsonSourceGenerationOptions(DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)] -internal partial class EcsJsonContext : JsonSerializerContext { } \ No newline at end of file +internal partial class EcsJsonContext : JsonSerializerContext { } diff --git a/src/Elastic.CommonSchema/Serialization/PropertiesReaderJsonConverterBase.cs b/src/Elastic.CommonSchema/Serialization/PropertiesReaderJsonConverterBase.cs index 883de095..5a24fd74 100644 --- a/src/Elastic.CommonSchema/Serialization/PropertiesReaderJsonConverterBase.cs +++ b/src/Elastic.CommonSchema/Serialization/PropertiesReaderJsonConverterBase.cs @@ -59,7 +59,7 @@ internal partial class EcsEntityJsonConverter internal partial class LogEntityJsonConverter { - private class LogFileOriginInvalid + internal class LogFileOriginInvalid { [JsonPropertyName("name"), DataMember(Name = "name")] public string? Name { get; set; } @@ -67,7 +67,7 @@ private class LogFileOriginInvalid [JsonPropertyName("line"), DataMember(Name = "line")] public int? Line { get; set; } } - private class LogOriginInvalid + internal class LogOriginInvalid { [JsonPropertyName("function"), DataMember(Name = "function")] public string? Function { get; set; } diff --git a/src/Specification/Specification.csproj b/src/Specification/Specification.csproj index 8c1f259b..80040b96 100644 --- a/src/Specification/Specification.csproj +++ b/src/Specification/Specification.csproj @@ -1,6 +1,6 @@ - net6.0 + net8.0 False diff --git a/tests-integration/Elastic.CommonSchema.BenchmarkDotNetExporter.IntegrationTests/Elastic.CommonSchema.BenchmarkDotNetExporter.IntegrationTests.csproj b/tests-integration/Elastic.CommonSchema.BenchmarkDotNetExporter.IntegrationTests/Elastic.CommonSchema.BenchmarkDotNetExporter.IntegrationTests.csproj index e77e9f69..2ea3f7e2 100644 --- a/tests-integration/Elastic.CommonSchema.BenchmarkDotNetExporter.IntegrationTests/Elastic.CommonSchema.BenchmarkDotNetExporter.IntegrationTests.csproj +++ b/tests-integration/Elastic.CommonSchema.BenchmarkDotNetExporter.IntegrationTests/Elastic.CommonSchema.BenchmarkDotNetExporter.IntegrationTests.csproj @@ -1,7 +1,7 @@ - net6.0 + net8.0 false diff --git a/tests-integration/Elastic.Extensions.Logging.IntegrationTests/Elastic.Extensions.Logging.IntegrationTests.csproj b/tests-integration/Elastic.Extensions.Logging.IntegrationTests/Elastic.Extensions.Logging.IntegrationTests.csproj index d91aa00e..a0598dee 100644 --- a/tests-integration/Elastic.Extensions.Logging.IntegrationTests/Elastic.Extensions.Logging.IntegrationTests.csproj +++ b/tests-integration/Elastic.Extensions.Logging.IntegrationTests/Elastic.Extensions.Logging.IntegrationTests.csproj @@ -1,7 +1,7 @@ - net6.0 + net8.0 false diff --git a/tests-integration/Elastic.Ingest.Elasticsearch.CommonSchema.IntegrationTests/Elastic.Ingest.Elasticsearch.CommonSchema.IntegrationTests.csproj b/tests-integration/Elastic.Ingest.Elasticsearch.CommonSchema.IntegrationTests/Elastic.Ingest.Elasticsearch.CommonSchema.IntegrationTests.csproj index 35e528a9..e34852b3 100644 --- a/tests-integration/Elastic.Ingest.Elasticsearch.CommonSchema.IntegrationTests/Elastic.Ingest.Elasticsearch.CommonSchema.IntegrationTests.csproj +++ b/tests-integration/Elastic.Ingest.Elasticsearch.CommonSchema.IntegrationTests/Elastic.Ingest.Elasticsearch.CommonSchema.IntegrationTests.csproj @@ -1,7 +1,7 @@ - net6.0 + net8.0 enable enable diff --git a/tests-integration/Elastic.NLog.Targets.IntegrationTests/Elastic.NLog.Targets.IntegrationTests.csproj b/tests-integration/Elastic.NLog.Targets.IntegrationTests/Elastic.NLog.Targets.IntegrationTests.csproj index 7790d7d4..baeabe05 100644 --- a/tests-integration/Elastic.NLog.Targets.IntegrationTests/Elastic.NLog.Targets.IntegrationTests.csproj +++ b/tests-integration/Elastic.NLog.Targets.IntegrationTests/Elastic.NLog.Targets.IntegrationTests.csproj @@ -1,7 +1,7 @@ - net6.0 + net8.0 false NLog.Targets.Elastic.IntegrationTests diff --git a/tests-integration/Elastic.Serilog.Sinks.IntegrationTests/Elastic.Serilog.Sinks.IntegrationTests.csproj b/tests-integration/Elastic.Serilog.Sinks.IntegrationTests/Elastic.Serilog.Sinks.IntegrationTests.csproj index 9a714e5a..b53f0b16 100644 --- a/tests-integration/Elastic.Serilog.Sinks.IntegrationTests/Elastic.Serilog.Sinks.IntegrationTests.csproj +++ b/tests-integration/Elastic.Serilog.Sinks.IntegrationTests/Elastic.Serilog.Sinks.IntegrationTests.csproj @@ -1,7 +1,7 @@  - net6.0 + net8.0 latest False enable diff --git a/tests-integration/Elasticsearch.IntegrationDefaults/Elasticsearch.IntegrationDefaults.csproj b/tests-integration/Elasticsearch.IntegrationDefaults/Elasticsearch.IntegrationDefaults.csproj index f95fa3a9..e2e40c3c 100644 --- a/tests-integration/Elasticsearch.IntegrationDefaults/Elasticsearch.IntegrationDefaults.csproj +++ b/tests-integration/Elasticsearch.IntegrationDefaults/Elasticsearch.IntegrationDefaults.csproj @@ -1,7 +1,7 @@ - net6.0 + net8.0 enable enable Library diff --git a/tests/Elastic.Apm.Disabled.Serilog.Tests/Elastic.Apm.Disabled.Serilog.Tests.csproj b/tests/Elastic.Apm.Disabled.Serilog.Tests/Elastic.Apm.Disabled.Serilog.Tests.csproj index 0e579807..a96891f9 100644 --- a/tests/Elastic.Apm.Disabled.Serilog.Tests/Elastic.Apm.Disabled.Serilog.Tests.csproj +++ b/tests/Elastic.Apm.Disabled.Serilog.Tests/Elastic.Apm.Disabled.Serilog.Tests.csproj @@ -1,7 +1,7 @@ - net6.0 + net8.0 enable enable diff --git a/tests/Elastic.Apm.NLog.Tests/Elastic.Apm.NLog.Tests.csproj b/tests/Elastic.Apm.NLog.Tests/Elastic.Apm.NLog.Tests.csproj index 09a8254c..e63b0d07 100644 --- a/tests/Elastic.Apm.NLog.Tests/Elastic.Apm.NLog.Tests.csproj +++ b/tests/Elastic.Apm.NLog.Tests/Elastic.Apm.NLog.Tests.csproj @@ -1,7 +1,7 @@ - net6.0 + net8.0 diff --git a/tests/Elastic.Apm.SerilogEnricher.Tests/Elastic.Apm.SerilogEnricher.Tests.csproj b/tests/Elastic.Apm.SerilogEnricher.Tests/Elastic.Apm.SerilogEnricher.Tests.csproj index 377ebab1..7d921a5f 100644 --- a/tests/Elastic.Apm.SerilogEnricher.Tests/Elastic.Apm.SerilogEnricher.Tests.csproj +++ b/tests/Elastic.Apm.SerilogEnricher.Tests/Elastic.Apm.SerilogEnricher.Tests.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 diff --git a/tests/Elastic.CommonSchema.Log4net.Tests/Elastic.CommonSchema.Log4net.Tests.csproj b/tests/Elastic.CommonSchema.Log4net.Tests/Elastic.CommonSchema.Log4net.Tests.csproj index ba73f905..27e001e8 100644 --- a/tests/Elastic.CommonSchema.Log4net.Tests/Elastic.CommonSchema.Log4net.Tests.csproj +++ b/tests/Elastic.CommonSchema.Log4net.Tests/Elastic.CommonSchema.Log4net.Tests.csproj @@ -1,7 +1,7 @@ - net6.0 + net8.0 false diff --git a/tests/Elastic.CommonSchema.NLog.Tests/Elastic.CommonSchema.NLog.Tests.csproj b/tests/Elastic.CommonSchema.NLog.Tests/Elastic.CommonSchema.NLog.Tests.csproj index 24358aab..15fd692d 100644 --- a/tests/Elastic.CommonSchema.NLog.Tests/Elastic.CommonSchema.NLog.Tests.csproj +++ b/tests/Elastic.CommonSchema.NLog.Tests/Elastic.CommonSchema.NLog.Tests.csproj @@ -1,7 +1,7 @@ - net6.0 + net8.0 false NU1701 diff --git a/tests/Elastic.CommonSchema.NLog.Tests/MessageTests.cs b/tests/Elastic.CommonSchema.NLog.Tests/MessageTests.cs index b34fa553..1e5f4bfe 100644 --- a/tests/Elastic.CommonSchema.NLog.Tests/MessageTests.cs +++ b/tests/Elastic.CommonSchema.NLog.Tests/MessageTests.cs @@ -149,7 +149,7 @@ public void SerializesKnownBadObject() => TestLogger((logger, getLogEvents) => var ecsEvents = ToEcsEvents(logEvents); var (_, info) = ecsEvents.First(); - info.Message.Should().StartWith("Info {\"MethodInfoProperty"); + info.Message.Should().StartWith("Info {\"TypeProperty"); info.Metadata.Should().ContainKey("EvilValue"); var x = info.Metadata["EvilValue"] as Dictionary; @@ -167,7 +167,7 @@ public void SerializesObjectThatThrowsOnGetter() => TestLogger((logger, getLogEv var ecsEvents = ToEcsEvents(logEvents); var (_, info) = ecsEvents.First(); - info.Message.Should().StartWith("Info {\"MethodInfoProperty"); + info.Message.Should().StartWith("Info {\"TypeProperty"); info.Metadata.Should().NotContainKey("EvilValue"); info.Metadata.Should().ContainKey("__failures__"); diff --git a/tests/Elastic.CommonSchema.Serilog.Tests/Elastic.CommonSchema.Serilog.Tests.csproj b/tests/Elastic.CommonSchema.Serilog.Tests/Elastic.CommonSchema.Serilog.Tests.csproj index f87c0c77..9e917b57 100644 --- a/tests/Elastic.CommonSchema.Serilog.Tests/Elastic.CommonSchema.Serilog.Tests.csproj +++ b/tests/Elastic.CommonSchema.Serilog.Tests/Elastic.CommonSchema.Serilog.Tests.csproj @@ -1,7 +1,7 @@  - net6.0 + net8.0 false SYSLIB1015;SYSLIB1014 diff --git a/tests/Elastic.CommonSchema.Tests/Elastic.CommonSchema.Tests.csproj b/tests/Elastic.CommonSchema.Tests/Elastic.CommonSchema.Tests.csproj index 8cd6cecb..71a4eeb8 100644 --- a/tests/Elastic.CommonSchema.Tests/Elastic.CommonSchema.Tests.csproj +++ b/tests/Elastic.CommonSchema.Tests/Elastic.CommonSchema.Tests.csproj @@ -1,7 +1,7 @@  - net6.0 + net8.0;net6.0 false diff --git a/tests/Elastic.CommonSchema.Tests/Repro/GithubIssue438.cs b/tests/Elastic.CommonSchema.Tests/Repro/GithubIssue438.cs new file mode 100644 index 00000000..d231f95f --- /dev/null +++ b/tests/Elastic.CommonSchema.Tests/Repro/GithubIssue438.cs @@ -0,0 +1,30 @@ +using System; +using FluentAssertions; +using Xunit; + +namespace Elastic.CommonSchema.Tests.Repro +{ + public class GithubIssue438 + { + [Fact] + public void Reproduce() + { + // language=json + var json = + """ + { + "@timestamp":"2022-11-08T09:36:37.249Z", + "log.level":"info", + "message":"['vo_phi_pkg\\\\runtime_recon.py']", + "ecs":{"version":"1.6.0"}, + "log":{ + "logger":"root", + "origin":{"file":{"line":90,"name":"main.py"},"function":"prepare_logging"}, + "original":"['vo_phi_pkg\\\\runtime_recon.py']"}, + "process":{"name":"MainProcess","pid":35436,"thread":{"id":13180,"name":"MainThread"}} + } + """; + var entry1 = System.Text.Json.JsonSerializer.Deserialize(json); + } + } +} diff --git a/tools/Elastic.CommonSchema.Benchmarks/Elastic.CommonSchema.Benchmarks.csproj b/tools/Elastic.CommonSchema.Benchmarks/Elastic.CommonSchema.Benchmarks.csproj index 7276e53b..303d6f06 100644 --- a/tools/Elastic.CommonSchema.Benchmarks/Elastic.CommonSchema.Benchmarks.csproj +++ b/tools/Elastic.CommonSchema.Benchmarks/Elastic.CommonSchema.Benchmarks.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 diff --git a/tools/Elastic.CommonSchema.Generator/Elastic.CommonSchema.Generator.csproj b/tools/Elastic.CommonSchema.Generator/Elastic.CommonSchema.Generator.csproj index fbcf7d97..ef26f0ea 100644 --- a/tools/Elastic.CommonSchema.Generator/Elastic.CommonSchema.Generator.csproj +++ b/tools/Elastic.CommonSchema.Generator/Elastic.CommonSchema.Generator.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 False False true