├── .github
├── CODEOWNERS
├── .github.csproj
├── workflows
│ ├── pre-commit.yml
│ ├── docs-cleanup.yml
│ ├── github-commands-comment.yml
│ ├── docs-build.yml
│ ├── bootstrap
│ │ └── action.yml
│ ├── test-reporter.yml
│ ├── test-docs.yml
│ └── update-specs.yml
├── dependabot.yml
├── ISSUE_TEMPLATE
│ ├── feature_request.md
│ └── bug_report.md
└── update-specs.yml
├── nuget-icon.png
├── tests
├── Elastic.CommonSchema.Tests
│ ├── Specs
│ │ └── spec_version.txt
│ ├── Elastic.CommonSchema.Tests.csproj
│ └── Repro
│ │ ├── GithubIssue29.cs
│ │ ├── GithubIssue178.cs
│ │ ├── GithubIssue438.cs
│ │ └── GithubIssue316.cs
├── .runsettings
├── Elastic.Apm.Test.Common
│ ├── Elastic.Apm.Test.Common.csproj
│ ├── NoopPayloadSender.cs
│ └── TestApmAgent.cs
├── Elastic.Serilog.Sinks.Tests
│ ├── ConfigurationBuilderExtensions.cs
│ ├── Elastic.Serilog.Sinks.Tests.csproj
│ └── JsonStringConfigSource.cs
├── Elastic.CommonSchema.Log4net.Tests
│ ├── Elastic.CommonSchema.Log4net.Tests.csproj
│ ├── TestAppender.cs
│ └── LogTestsBase.cs
├── Elastic.Apm.SerilogEnricher.Tests
│ └── Elastic.Apm.SerilogEnricher.Tests.csproj
├── Elastic.Apm.Disabled.Serilog.Tests
│ └── Elastic.Apm.Disabled.Serilog.Tests.csproj
├── Elastic.Apm.NLog.Tests
│ └── Elastic.Apm.NLog.Tests.csproj
├── Elastic.CommonSchema.NLog.Tests
│ ├── Elastic.CommonSchema.NLog.Tests.csproj
│ ├── EcsFieldsInTemplateTests.cs
│ └── OutputTests.cs
├── Elastic.CommonSchema.Serilog.Tests
│ ├── Repro
│ │ ├── GithubIssue225.cs
│ │ ├── GithubIssue31.cs
│ │ └── GithubIssue30.cs
│ └── OutputTests.cs
└── Directory.Build.props
├── docs
├── reference
│ ├── images
│ │ └── ecs-dotnet-overview.png
│ ├── _enrichers_2.md
│ ├── data-shippers.md
│ ├── intro_to_xyz.md
│ ├── toc.yml
│ └── _elasticsearch_security.md
├── docs.csproj
└── docset.yml
├── global.json
├── nuget.config
├── examples
├── console-with-extensions-logging
│ ├── example-elasticsearch-kibana.png
│ ├── appsettings.json
│ ├── console-with-extensions-logging.csproj
│ └── docker-compose.yml
├── aspnetcore-with-extensions-logging
│ ├── appsettings.Development.json
│ ├── appsettings.json
│ ├── WeatherForecast.cs
│ ├── aspnetcore-with-extensions-logging.csproj
│ └── Program.cs
├── aspnetcore-with-serilog
│ ├── appsettings.Development.json
│ ├── appsettings.json
│ ├── WeatherForecast.cs
│ ├── AspnetCoreExample.csproj
│ ├── Controllers
│ │ └── WeatherForecastController.cs
│ └── Startup.cs
├── Elastic.Extensions.Logging.Example
│ ├── appsettings.json
│ ├── HighVolumeWorkSimulation.cs
│ └── Elastic.Extensions.Logging.Example.csproj
├── playground
│ └── playground.csproj
├── Elastic.Extensions.Logging.Console.Example
│ ├── Elastic.Extensions.Logging.Console.Example.csproj
│ ├── ExampleService.cs
│ └── Program.cs
├── ecs-aot-smoketest
│ ├── ecs-aot-smoketest.csproj
│ └── SerilogExporter.cs
└── Elastic.Serilog.Sinks.Example
│ └── Elastic.Serilog.Sinks.Example.csproj
├── src
├── Specification
│ ├── Specification.csproj
│ ├── v8.11.0
│ │ └── composable
│ │ │ └── component
│ │ │ ├── ecs.json
│ │ │ ├── base.json
│ │ │ ├── data_stream.json
│ │ │ ├── group.json
│ │ │ ├── organization.json
│ │ │ ├── related.json
│ │ │ ├── tracing.json
│ │ │ ├── device.json
│ │ │ ├── error.json
│ │ │ ├── agent.json
│ │ │ ├── faas.json
│ │ │ ├── registry.json
│ │ │ └── rule.json
│ ├── v8.3.1
│ │ └── composable
│ │ │ └── component
│ │ │ ├── ecs.json
│ │ │ ├── base.json
│ │ │ ├── data_stream.json
│ │ │ ├── group.json
│ │ │ ├── organization.json
│ │ │ ├── related.json
│ │ │ ├── tracing.json
│ │ │ ├── error.json
│ │ │ ├── agent.json
│ │ │ ├── registry.json
│ │ │ ├── faas.json
│ │ │ └── rule.json
│ ├── v8.4.0
│ │ └── composable
│ │ │ └── component
│ │ │ ├── ecs.json
│ │ │ ├── base.json
│ │ │ ├── data_stream.json
│ │ │ ├── group.json
│ │ │ ├── organization.json
│ │ │ ├── related.json
│ │ │ ├── tracing.json
│ │ │ ├── error.json
│ │ │ ├── agent.json
│ │ │ ├── registry.json
│ │ │ └── faas.json
│ ├── v8.6.0
│ │ └── composable
│ │ │ └── component
│ │ │ ├── ecs.json
│ │ │ ├── base.json
│ │ │ ├── data_stream.json
│ │ │ ├── group.json
│ │ │ ├── organization.json
│ │ │ ├── related.json
│ │ │ ├── tracing.json
│ │ │ ├── device.json
│ │ │ ├── error.json
│ │ │ ├── agent.json
│ │ │ ├── registry.json
│ │ │ └── faas.json
│ ├── v9.0.0
│ │ └── composable
│ │ │ └── component
│ │ │ ├── ecs.json
│ │ │ ├── base.json
│ │ │ ├── data_stream.json
│ │ │ ├── group.json
│ │ │ ├── organization.json
│ │ │ ├── tracing.json
│ │ │ ├── related.json
│ │ │ ├── error.json
│ │ │ ├── device.json
│ │ │ ├── agent.json
│ │ │ ├── faas.json
│ │ │ └── registry.json
│ └── README.md
├── Elastic.Extensions.Logging.Common
│ ├── README.md
│ ├── LogEventJsonContext.cs
│ ├── Elastic.Extensions.Logging.Common.csproj
│ ├── ILogEventCreationOptions.cs
│ └── LogEventToEcsHelper.cs
├── NullableExtensions.cs
├── Elastic.CommonSchema.Serilog
│ ├── SpecialKeys.cs
│ ├── Elastic.CommonSchema.Serilog.csproj
│ ├── Adapters
│ │ └── IHttpAdapter.cs
│ └── ScalarPropertyExtensions.cs
├── Elastic.CommonSchema.NLog
│ ├── NLogEcsJsonContext.cs
│ ├── NlogEcsDocumentCreationOptions.cs
│ └── Elastic.CommonSchema.NLog.csproj
├── Elastic.Serilog.Enrichers.Web
│ ├── README.md
│ └── Elastic.Serilog.Enrichers.Web.csproj
├── Elastic.CommonSchema
│ ├── Entities.cs
│ ├── MetadataDictionary.cs
│ ├── Entities.ShouldSerialize.Generated.cs
│ ├── Elastic.CommonSchema.csproj
│ └── Serialization
│ │ └── SnakeCaseJsonNamingPolicy.cs
├── Elastic.Ingest.Elasticsearch.CommonSchema
│ └── Elastic.Ingest.Elasticsearch.CommonSchema.csproj
├── Elastic.Apm.SerilogEnricher
│ ├── Elastic.Apm.SerilogEnricher.csproj
│ └── ElasticApmEnricherExtension.cs
├── Elastic.Serilog.Sinks
│ └── Elastic.Serilog.Sinks.csproj
├── Elastic.Extensions.Logging
│ ├── ElasticsearchLoggerOptionsSetup.cs
│ ├── Options
│ │ ├── DataStreamNameOptions.cs
│ │ ├── IndexNameOptions.cs
│ │ └── NodePoolType.cs
│ ├── IChannelProvider.cs
│ ├── IChannelSetup.cs
│ ├── InternalChannelSetup.cs
│ └── Elastic.Extensions.Logging.csproj
├── Elastic.NLog.Targets
│ ├── ElasticPoolType.cs
│ └── Elastic.NLog.Targets.csproj
├── Elastic.CommonSchema.Log4net
│ ├── Elastic.CommonSchema.Log4net.csproj
│ └── EcsLayout.cs
├── Elastic.CommonSchema.BenchmarkDotNetExporter
│ ├── Domain
│ │ ├── BenchmarkSimplifiedWorkloadCounts.cs
│ │ ├── BenchmarkMeasurementStage.cs
│ │ ├── BenchmarkGit.cs
│ │ ├── BenchmarkAgent.cs
│ │ ├── BenchmarkJobConfig.cs
│ │ └── BenchmarkEvent.cs
│ └── Elastic.CommonSchema.BenchmarkDotNetExporter.csproj
├── Elastic.Apm.NLog
│ ├── ApmSpanIdLayoutRenderer.cs
│ ├── ApmServiceVersionLayoutRenderer.cs
│ ├── ApmServiceNodeNameLayoutRenderer.cs
│ ├── Elastic.Apm.NLog.csproj
│ ├── ApmServiceNameLayoutRenderer.cs
│ ├── ApmTraceIdLayoutRenderer.cs
│ └── ApmTransactionIdLayoutRenderer.cs
└── Elastic.Extensions.Logging.Console
│ ├── README.md
│ ├── Elastic.Extensions.Logging.Console.csproj
│ ├── LoggingBuilderExtensions.cs
│ └── EcsConsoleFormatterOptions.cs
├── .ci.runsettings
├── tests-integration
├── .runsettings
├── Elastic.NLog.Targets.IntegrationTests
│ ├── LoggingCluster.cs
│ └── Elastic.NLog.Targets.IntegrationTests.csproj
├── Elastic.Extensions.Logging.IntegrationTests
│ ├── LoggingCluster.cs
│ └── Elastic.Extensions.Logging.IntegrationTests.csproj
├── Elastic.CommonSchema.BenchmarkDotNetExporter.IntegrationTests
│ ├── BenchmarkCluster.cs
│ ├── Md5VsSha256.cs
│ └── Elastic.CommonSchema.BenchmarkDotNetExporter.IntegrationTests.csproj
├── Elasticsearch.IntegrationDefaults
│ └── Elasticsearch.IntegrationDefaults.csproj
├── Elastic.Ingest.Elasticsearch.CommonSchema.IntegrationTests
│ ├── IngestionCluster.cs
│ ├── IntegrationTestBase.cs
│ ├── Elastic.Ingest.Elasticsearch.CommonSchema.IntegrationTests.csproj
│ └── CustomEventWriter.cs
├── Elastic.Serilog.Sinks.IntegrationTests
│ ├── Elastic.Serilog.Sinks.IntegrationTests.csproj
│ └── SerilogTestBase.cs
└── Directory.Build.props
├── tools
├── Elastic.CommonSchema.Benchmarks
│ ├── Program.cs
│ └── Elastic.CommonSchema.Benchmarks.csproj
└── Elastic.CommonSchema.Generator
│ ├── Projection
│ ├── IndexComponent.cs
│ └── IndexTemplate.cs
│ ├── Schema
│ ├── DTO
│ │ ├── FieldLevel.cs
│ │ ├── YamlSchemaReusedHere.cs
│ │ ├── FieldAllowedValue.cs
│ │ ├── FieldMultiField.cs
│ │ └── FieldType.cs
│ └── EcsSchema.cs
│ ├── Views
│ ├── CodeTemplatePage.cs
│ ├── Entities.ShouldSerialize.Generated.cshtml
│ ├── EcsJsonContext.Generated.cshtml
│ └── AssignableInterfaces.Generated.cshtml
│ └── CodeConfiguration.cs
├── .pre-commit-config.yaml
├── .gitattributes
├── dotnet-tools.json
├── issue_template.md
├── .gitignore
└── Directory.Build.props
/.github/CODEOWNERS:
--------------------------------------------------------------------------------
1 | /.github/workflows @elastic/observablt-ci
--------------------------------------------------------------------------------
/nuget-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/elastic/ecs-dotnet/HEAD/nuget-icon.png
--------------------------------------------------------------------------------
/tests/Elastic.CommonSchema.Tests/Specs/spec_version.txt:
--------------------------------------------------------------------------------
1 | 868cdfb178bc1959003c62aefed4d5b0c10af4c0
--------------------------------------------------------------------------------
/docs/reference/images/ecs-dotnet-overview.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/elastic/ecs-dotnet/HEAD/docs/reference/images/ecs-dotnet-overview.png
--------------------------------------------------------------------------------
/global.json:
--------------------------------------------------------------------------------
1 | {
2 | "sdk": {
3 | "version": "9.0.100",
4 | "rollForward": "latestFeature",
5 | "allowPrerelease": false
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/nuget.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/examples/console-with-extensions-logging/example-elasticsearch-kibana.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/elastic/ecs-dotnet/HEAD/examples/console-with-extensions-logging/example-elasticsearch-kibana.png
--------------------------------------------------------------------------------
/docs/docs.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | net8.0
4 | False
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.github/.github.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | net8.0
4 | False
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/examples/aspnetcore-with-extensions-logging/appsettings.Development.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Information",
5 | "Microsoft.AspNetCore": "Information"
6 | }
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/src/Specification/Specification.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | net8.0
4 | False
5 |
6 |
7 |
--------------------------------------------------------------------------------
/src/Elastic.Extensions.Logging.Common/README.md:
--------------------------------------------------------------------------------
1 | # Elastic.Extensions.Logging.Common
2 |
3 | Transitive dependency for `Elastic.Extensions.Logging` and `Elastic.Extensions.Logging.Console`.
4 |
5 | Should not be installed directly.
--------------------------------------------------------------------------------
/examples/aspnetcore-with-extensions-logging/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Information",
5 | "Microsoft.AspNetCore": "Warning"
6 | }
7 | },
8 | "AllowedHosts": "*"
9 | }
10 |
--------------------------------------------------------------------------------
/.ci.runsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/tests/.runsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/src/NullableExtensions.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics.CodeAnalysis;
2 |
3 | namespace System;
4 | internal static class NullableStringExtensions {
5 | internal static bool IsNullOrEmpty([NotNullWhen(false)] this string? data) =>
6 | string.IsNullOrEmpty(data);
7 | }
8 |
--------------------------------------------------------------------------------
/tests-integration/.runsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/tools/Elastic.CommonSchema.Benchmarks/Program.cs:
--------------------------------------------------------------------------------
1 | using BenchmarkDotNet.Running;
2 |
3 | namespace Elastic.CommonSchema.Benchmarks;
4 |
5 | internal class Program
6 | {
7 | public static void Main(string[] args) => BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args);
8 | }
9 |
--------------------------------------------------------------------------------
/examples/aspnetcore-with-serilog/appsettings.Development.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Information",
5 | "Microsoft": "Warning",
6 | "Microsoft.Hosting.Lifetime": "Information",
7 | "Elastic.Apm": "Error"
8 | }
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/examples/aspnetcore-with-serilog/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Information",
5 | "Microsoft": "Warning",
6 | "Microsoft.Hosting.Lifetime": "Information",
7 | "Elastic.Apm": "Error"
8 | }
9 | },
10 | "AllowedHosts": "*"
11 | }
12 |
--------------------------------------------------------------------------------
/src/Elastic.CommonSchema.Serilog/SpecialKeys.cs:
--------------------------------------------------------------------------------
1 | // Licensed to Elasticsearch B.V under one or more agreements.
2 | // Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3 | // See the LICENSE file in the project root for more information
4 |
5 | namespace Elastic.CommonSchema.Serilog;
6 |
7 |
--------------------------------------------------------------------------------
/.github/workflows/pre-commit.yml:
--------------------------------------------------------------------------------
1 | name: pre-commit
2 |
3 | on:
4 | pull_request:
5 | push:
6 | branches:
7 | - main
8 | - 1.*
9 |
10 | permissions:
11 | contents: read
12 |
13 | jobs:
14 | pre-commit:
15 | runs-on: ubuntu-latest
16 | steps:
17 | - uses: elastic/oblt-actions/pre-commit@v1
--------------------------------------------------------------------------------
/tests/Elastic.Apm.Test.Common/Elastic.Apm.Test.Common.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/docs/reference/_enrichers_2.md:
--------------------------------------------------------------------------------
1 | ---
2 | mapped_pages:
3 | - https://www.elastic.co/guide/en/ecs-logging/dotnet/current/_enrichers_2.html
4 | ---
5 |
6 | # Enrichers [_enrichers_2]
7 |
8 | Enrichers can be installed next to `Log Formatters` and `Data Shippers` to automatically enrich the ECS json that gets produced.
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.github/workflows/docs-cleanup.yml:
--------------------------------------------------------------------------------
1 | name: docs-cleanup
2 |
3 | on:
4 | pull_request_target:
5 | types:
6 | - closed
7 |
8 | jobs:
9 | docs-preview:
10 | uses: elastic/docs-builder/.github/workflows/preview-cleanup.yml@main
11 | permissions:
12 | contents: none
13 | id-token: write
14 | deployments: write
15 |
--------------------------------------------------------------------------------
/examples/Elastic.Extensions.Logging.Example/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "Elasticsearch": {
4 | "ShipTo": {
5 | "NodePoolType": "Static",
6 | "NodeUris": [ "http://localhost:9200" ]
7 | }
8 | },
9 | "LogLevel" : {
10 | "Default": "Trace",
11 | "Microsoft": "Warning"
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/examples/aspnetcore-with-extensions-logging/WeatherForecast.cs:
--------------------------------------------------------------------------------
1 | namespace aspnetcore_with_extensions_logging;
2 |
3 | public class WeatherForecast
4 | {
5 | public DateTime Date { get; set; }
6 |
7 | public int TemperatureC { get; set; }
8 |
9 | public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
10 |
11 | public string? Summary { get; set; }
12 | }
13 |
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | version: 2
2 | updates:
3 |
4 | # GitHub actions
5 | - package-ecosystem: "github-actions"
6 | directories:
7 | - "/"
8 | - "/.github/workflows/*"
9 | schedule:
10 | interval: "weekly"
11 | day: "sunday"
12 | time: "22:00"
13 | groups:
14 | github-actions:
15 | patterns:
16 | - "*"
17 |
--------------------------------------------------------------------------------
/.pre-commit-config.yaml:
--------------------------------------------------------------------------------
1 | repos:
2 | - repo: https://github.com/pre-commit/pre-commit-hooks
3 | rev: v2.2.3
4 | hooks:
5 | - id: check-case-conflict
6 | - id: check-executables-have-shebangs
7 | - id: check-merge-conflict
8 |
9 | - repo: https://github.com/elastic/apm-pipeline-library
10 | rev: current
11 | hooks:
12 | - id: check-bash-syntax
13 |
--------------------------------------------------------------------------------
/docs/docset.yml:
--------------------------------------------------------------------------------
1 | project: 'ECS Logging .NET'
2 | products:
3 | - id: ecs-logging
4 | cross_links:
5 | - apm-agent-dotnet
6 | - beats
7 | - docs-content
8 | - ecs
9 | - ecs-logging
10 | toc:
11 | - toc: reference
12 | subs:
13 | ecs-ref: "https://www.elastic.co/guide/en/ecs/current"
14 | stack: "Elastic Stack"
15 | es: "Elasticsearch"
16 | filebeat: "Filebeat"
17 |
--------------------------------------------------------------------------------
/tests/Elastic.Serilog.Sinks.Tests/ConfigurationBuilderExtensions.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Extensions.Configuration;
2 |
3 | namespace Elastic.Serilog.Sinks.Tests;
4 |
5 | internal static class ConfigurationBuilderExtensions
6 | {
7 | public static IConfigurationBuilder AddJsonString(this IConfigurationBuilder builder, string json) =>
8 | builder.Add(new JsonStringConfigSource(json));
9 | }
10 |
--------------------------------------------------------------------------------
/.github/workflows/github-commands-comment.yml:
--------------------------------------------------------------------------------
1 | ---
2 | name: github-commands-comment
3 |
4 | on:
5 | pull_request_target:
6 | types:
7 | - opened
8 |
9 | permissions:
10 | contents: read
11 |
12 | jobs:
13 | comment:
14 | runs-on: ubuntu-latest
15 | permissions:
16 | pull-requests: write
17 | steps:
18 | - uses: elastic/oblt-actions/elastic/github-commands@v1
19 |
--------------------------------------------------------------------------------
/examples/aspnetcore-with-serilog/WeatherForecast.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace AspnetCoreExample
4 | {
5 | public class WeatherForecast
6 | {
7 | public DateTime Date { get; set; }
8 |
9 | public int TemperatureC { get; set; }
10 |
11 | public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
12 |
13 | public string Summary { get; set; }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/Elastic.CommonSchema.NLog/NLogEcsJsonContext.cs:
--------------------------------------------------------------------------------
1 | using System.Text.Json.Serialization;
2 |
3 | namespace Elastic.CommonSchema.NLog;
4 |
5 | ///
6 | ///
7 | ///
8 | [JsonSerializable(typeof(EcsLayout.NLogEcsDocument))]
9 | [JsonSourceGenerationOptions(DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)]
10 | public partial class NLogEcsJsonContext : JsonSerializerContext { }
11 |
--------------------------------------------------------------------------------
/src/Elastic.Extensions.Logging.Common/LogEventJsonContext.cs:
--------------------------------------------------------------------------------
1 | using System.Text.Json.Serialization;
2 |
3 | namespace Elastic.Extensions.Logging.Common;
4 |
5 | ///
6 | ///
7 | ///
8 | [JsonSerializable(typeof(LogEvent))]
9 | [JsonSourceGenerationOptions(DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)]
10 | public partial class LogEventJsonContext : JsonSerializerContext;
11 |
--------------------------------------------------------------------------------
/.github/workflows/docs-build.yml:
--------------------------------------------------------------------------------
1 | name: docs-build
2 |
3 | on:
4 | push:
5 | branches:
6 | - main
7 | pull_request_target: ~
8 | merge_group: ~
9 |
10 | jobs:
11 | docs-preview:
12 | uses: elastic/docs-builder/.github/workflows/preview-build.yml@main
13 | with:
14 | path-pattern: docs/**
15 | permissions:
16 | deployments: write
17 | id-token: write
18 | contents: read
19 | pull-requests: write
20 |
--------------------------------------------------------------------------------
/docs/reference/data-shippers.md:
--------------------------------------------------------------------------------
1 | ---
2 | mapped_pages:
3 | - https://www.elastic.co/guide/en/ecs-logging/dotnet/current/data-shippers.html
4 | ---
5 |
6 | # Data shippers [data-shippers]
7 |
8 | Our datashippers integrate with logging frameworks to facilitate sending events (such as logs) to various outputs.
9 |
10 | Currently these shippers support Elastic Cloud & Elasticsearch but other outputs are in the works.
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/src/Elastic.Serilog.Enrichers.Web/README.md:
--------------------------------------------------------------------------------
1 | # Elastic.Serilog.Enrichers.Web
2 |
3 | Adds extension methods for ASP.NET (Core and Full Framework) to enrich emitted ECS data with important HTTP information.
4 |
5 | ```csharp
6 | .UseSerilog((ctx, config) =>
7 | {
8 | // Ensure HttpContextAccessor is accessible
9 | var httpAccessor = ctx.Configuration.Get();
10 |
11 | config
12 | .Enrich.WithEcsHttpContext(httpAccessor);
13 | ```
--------------------------------------------------------------------------------
/src/Elastic.CommonSchema.NLog/NlogEcsDocumentCreationOptions.cs:
--------------------------------------------------------------------------------
1 | namespace Elastic.CommonSchema.NLog;
2 |
3 | internal class NlogEcsDocumentCreationOptions : IEcsDocumentCreationOptions
4 | {
5 | public static NlogEcsDocumentCreationOptions Default { get; } = new();
6 | public bool IncludeHost { get; set; } = true;
7 | public bool IncludeProcess { get; set; } = false;
8 | public bool IncludeUser { get; set; } = false;
9 | public bool IncludeActivityData { get; set; } = false;
10 | }
11 |
--------------------------------------------------------------------------------
/src/Specification/v8.11.0/composable/component/ecs.json:
--------------------------------------------------------------------------------
1 | {
2 | "_meta": {
3 | "documentation": "https://www.elastic.co/guide/en/ecs/current/ecs-ecs.html",
4 | "ecs_version": "8.11.0"
5 | },
6 | "template": {
7 | "mappings": {
8 | "properties": {
9 | "ecs": {
10 | "properties": {
11 | "version": {
12 | "ignore_above": 1024,
13 | "type": "keyword"
14 | }
15 | }
16 | }
17 | }
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/Specification/v8.3.1/composable/component/ecs.json:
--------------------------------------------------------------------------------
1 | {
2 | "_meta": {
3 | "documentation": "https://www.elastic.co/guide/en/ecs/current/ecs-ecs.html",
4 | "ecs_version": "8.3.1"
5 | },
6 | "template": {
7 | "mappings": {
8 | "properties": {
9 | "ecs": {
10 | "properties": {
11 | "version": {
12 | "ignore_above": 1024,
13 | "type": "keyword"
14 | }
15 | }
16 | }
17 | }
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/Specification/v8.4.0/composable/component/ecs.json:
--------------------------------------------------------------------------------
1 | {
2 | "_meta": {
3 | "documentation": "https://www.elastic.co/guide/en/ecs/current/ecs-ecs.html",
4 | "ecs_version": "8.4.0"
5 | },
6 | "template": {
7 | "mappings": {
8 | "properties": {
9 | "ecs": {
10 | "properties": {
11 | "version": {
12 | "ignore_above": 1024,
13 | "type": "keyword"
14 | }
15 | }
16 | }
17 | }
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/Specification/v8.6.0/composable/component/ecs.json:
--------------------------------------------------------------------------------
1 | {
2 | "_meta": {
3 | "documentation": "https://www.elastic.co/guide/en/ecs/current/ecs-ecs.html",
4 | "ecs_version": "8.6.0"
5 | },
6 | "template": {
7 | "mappings": {
8 | "properties": {
9 | "ecs": {
10 | "properties": {
11 | "version": {
12 | "ignore_above": 1024,
13 | "type": "keyword"
14 | }
15 | }
16 | }
17 | }
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/Specification/v9.0.0/composable/component/ecs.json:
--------------------------------------------------------------------------------
1 | {
2 | "_meta": {
3 | "documentation": "https://www.elastic.co/guide/en/ecs/current/ecs-ecs.html",
4 | "ecs_version": "9.0.0"
5 | },
6 | "template": {
7 | "mappings": {
8 | "properties": {
9 | "ecs": {
10 | "properties": {
11 | "version": {
12 | "ignore_above": 1024,
13 | "type": "keyword"
14 | }
15 | }
16 | }
17 | }
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto eol=lf
3 |
4 | # Set default behavior for command prompt diff.
5 | # This gives output on command line taking C# language constructs into consideration (e.g showing class name)
6 | *.cs text diff=csharp
7 |
8 | # Set windows specific files explicitly to crlf line ending
9 | *.cmd eol=crlf
10 | *.bat eol=crlf
11 | *.ps1 eol=crlf
12 |
13 | # Mark files specifically as binary to avoid line ending conversion
14 | *.snk binary
15 | *.png binary
--------------------------------------------------------------------------------
/tests-integration/Elastic.NLog.Targets.IntegrationTests/LoggingCluster.cs:
--------------------------------------------------------------------------------
1 | using Elasticsearch.IntegrationDefaults;
2 | using Xunit;
3 |
4 | [assembly: TestFramework("Elastic.Elasticsearch.Xunit.Sdk.ElasticTestFramework", "Elastic.Elasticsearch.Xunit")]
5 |
6 | namespace NLog.Targets.Elastic.IntegrationTests;
7 |
8 | /// Declare our cluster that we want to inject into our test classes
9 | public class LoggingCluster : TestClusterBase
10 | {
11 | public LoggingCluster() : base(9201) { }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/src/Elastic.CommonSchema/Entities.cs:
--------------------------------------------------------------------------------
1 | using System.Text.Json.Serialization;
2 | using Elastic.CommonSchema.Serialization;
3 |
4 | namespace Elastic.CommonSchema;
5 |
6 | // This file only contains manual additions to entities.
7 | // These should be exceptions and not the norm.
8 | // Most of the entities are generated under Entities.Generated.cs
9 |
10 | [JsonConverter(typeof(LogEntityJsonConverter))]
11 | public partial class Log { }
12 | [JsonConverter(typeof(EcsEntityJsonConverter))]
13 | public partial class Ecs { }
14 |
15 |
--------------------------------------------------------------------------------
/tests-integration/Elastic.Extensions.Logging.IntegrationTests/LoggingCluster.cs:
--------------------------------------------------------------------------------
1 | using Elasticsearch.IntegrationDefaults;
2 | using Xunit;
3 |
4 | [assembly: TestFramework("Elastic.Elasticsearch.Xunit.Sdk.ElasticTestFramework", "Elastic.Elasticsearch.Xunit")]
5 |
6 | namespace Elastic.Extensions.Logging.IntegrationTests;
7 |
8 | /// Declare our cluster that we want to inject into our test classes
9 | public class LoggingCluster : TestClusterBase
10 | {
11 | public LoggingCluster() : base(9201) { }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/tools/Elastic.CommonSchema.Generator/Projection/IndexComponent.cs:
--------------------------------------------------------------------------------
1 | namespace Elastic.CommonSchema.Generator.Projection
2 | {
3 | public class IndexComponent
4 | {
5 | public string Name { get; }
6 | public string EcsName { get; }
7 | public string Component { get; }
8 |
9 | public IndexComponent(string name, string component, string schemaVersion)
10 | {
11 | Name = name.PascalCase();
12 | EcsName = $"ecs_{schemaVersion}_{name}";
13 | Component = component
14 | .Replace("\"", "\"\"");
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/Elastic.CommonSchema/MetadataDictionary.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Text.Json.Serialization;
3 | using Elastic.CommonSchema.Serialization;
4 |
5 | namespace Elastic.CommonSchema;
6 |
7 | ///
8 | /// A regular implementation that takes special care to not fail on (de)serialization
9 | /// and preserving the failures
10 | ///
11 | [JsonConverter(typeof(MetadataDictionaryConverter))]
12 | public class MetadataDictionary : Dictionary
13 | {
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/src/Specification/README.md:
--------------------------------------------------------------------------------
1 | # Specification folder
2 |
3 |
4 | This folder provides a local copy of the ECS spec to this repository.
5 |
6 | Used by [`tools/Elastic.CommonSchemaGenerator`](../../tools/Elastic.CommonSchema.Generator) to generate source code under `src`
7 |
8 | No automation exist currently for generating/updating the spec.
9 |
10 | Simply run
11 |
12 | ```bash
13 | dotnet run -c Release --project tools/Elastic.CommonSchema.Generator
14 | ```
15 |
16 | To kick of the interactive tool to download a new version of the spec and generate all codebases.
--------------------------------------------------------------------------------
/src/Elastic.Ingest.Elasticsearch.CommonSchema/Elastic.Ingest.Elasticsearch.CommonSchema.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0;netstandard2.1;net8.0
5 | True
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/src/Elastic.Apm.SerilogEnricher/Elastic.Apm.SerilogEnricher.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | netstandard2.0;net462;net8.0
4 | Elastic APM Serilog Enricher
5 | Enrich Serilog log messages with APM TraceId and TransactionId.
6 | True
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/tests-integration/Elastic.CommonSchema.BenchmarkDotNetExporter.IntegrationTests/BenchmarkCluster.cs:
--------------------------------------------------------------------------------
1 | using Elasticsearch.IntegrationDefaults;
2 | using Xunit;
3 |
4 | [assembly: TestFramework("Elastic.Elasticsearch.Xunit.Sdk.ElasticTestFramework", "Elastic.Elasticsearch.Xunit")]
5 |
6 | namespace Elastic.CommonSchema.BenchmarkDotNetExporter.IntegrationTests
7 | {
8 | /// Declare our cluster that we want to inject into our test classes
9 | public class BenchmarkCluster : TestClusterBase
10 | {
11 | public BenchmarkCluster() : base(9203) { }
12 |
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/tools/Elastic.CommonSchema.Generator/Schema/DTO/FieldLevel.cs:
--------------------------------------------------------------------------------
1 | // Licensed to Elasticsearch B.V under one or more agreements.
2 | // Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3 | // See the LICENSE file in the project root for more information
4 |
5 | using System.Runtime.Serialization;
6 |
7 | namespace Elastic.CommonSchema.Generator.Schema.DTO
8 | {
9 | ///
10 | /// ECS level
11 | ///
12 | public enum FieldLevel
13 | {
14 | [EnumMember(Value = "core")] Core,
15 | [EnumMember(Value = "extended")] Extended
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/Elastic.Serilog.Sinks/Elastic.Serilog.Sinks.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0;netstandard2.1;net8.0
5 | enable
6 | True
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/examples/console-with-extensions-logging/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "Elasticsearch": {
4 | "Tags": [ "Development", "Example" ],
5 | "IndexOffset": "00:00",
6 | "IsEnabled": true,
7 | "IncludeScopes": true,
8 | "IncludeHost": true,
9 | "IncludeProcess": true,
10 | "IncludeUser": true,
11 | "ShipTo": {
12 | "NodePoolType": "SingleNode",
13 | "NodeUris": [ "http://localhost:9200" ]
14 | }
15 | },
16 | "LogLevel" : {
17 | "Default": "Trace",
18 | "Microsoft": "Warning"
19 | }
20 | }
21 | }
--------------------------------------------------------------------------------
/examples/playground/playground.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net8.0
6 | enable
7 | enable
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/tests/Elastic.CommonSchema.Log4net.Tests/Elastic.CommonSchema.Log4net.Tests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 | false
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/src/Specification/v8.11.0/composable/component/base.json:
--------------------------------------------------------------------------------
1 | {
2 | "_meta": {
3 | "documentation": "https://www.elastic.co/guide/en/ecs/current/ecs-base.html",
4 | "ecs_version": "8.11.0"
5 | },
6 | "template": {
7 | "mappings": {
8 | "properties": {
9 | "@timestamp": {
10 | "type": "date"
11 | },
12 | "labels": {
13 | "type": "object"
14 | },
15 | "message": {
16 | "type": "match_only_text"
17 | },
18 | "tags": {
19 | "ignore_above": 1024,
20 | "type": "keyword"
21 | }
22 | }
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/Specification/v8.3.1/composable/component/base.json:
--------------------------------------------------------------------------------
1 | {
2 | "_meta": {
3 | "documentation": "https://www.elastic.co/guide/en/ecs/current/ecs-base.html",
4 | "ecs_version": "8.3.1"
5 | },
6 | "template": {
7 | "mappings": {
8 | "properties": {
9 | "@timestamp": {
10 | "type": "date"
11 | },
12 | "labels": {
13 | "type": "object"
14 | },
15 | "message": {
16 | "type": "match_only_text"
17 | },
18 | "tags": {
19 | "ignore_above": 1024,
20 | "type": "keyword"
21 | }
22 | }
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/Specification/v8.4.0/composable/component/base.json:
--------------------------------------------------------------------------------
1 | {
2 | "_meta": {
3 | "documentation": "https://www.elastic.co/guide/en/ecs/current/ecs-base.html",
4 | "ecs_version": "8.4.0"
5 | },
6 | "template": {
7 | "mappings": {
8 | "properties": {
9 | "@timestamp": {
10 | "type": "date"
11 | },
12 | "labels": {
13 | "type": "object"
14 | },
15 | "message": {
16 | "type": "match_only_text"
17 | },
18 | "tags": {
19 | "ignore_above": 1024,
20 | "type": "keyword"
21 | }
22 | }
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/Specification/v8.6.0/composable/component/base.json:
--------------------------------------------------------------------------------
1 | {
2 | "_meta": {
3 | "documentation": "https://www.elastic.co/guide/en/ecs/current/ecs-base.html",
4 | "ecs_version": "8.6.0"
5 | },
6 | "template": {
7 | "mappings": {
8 | "properties": {
9 | "@timestamp": {
10 | "type": "date"
11 | },
12 | "labels": {
13 | "type": "object"
14 | },
15 | "message": {
16 | "type": "match_only_text"
17 | },
18 | "tags": {
19 | "ignore_above": 1024,
20 | "type": "keyword"
21 | }
22 | }
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/tools/Elastic.CommonSchema.Benchmarks/Elastic.CommonSchema.Benchmarks.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net8.0
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/tests/Elastic.CommonSchema.Tests/Elastic.CommonSchema.Tests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 | false
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/tools/Elastic.CommonSchema.Generator/Schema/DTO/YamlSchemaReusedHere.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Elastic.CommonSchema.Generator.Schema.DTO
4 | {
5 | [JsonObject(MemberSerialization.OptIn)]
6 | public class YamlSchemaReusedHere
7 | {
8 | [JsonProperty("full")]
9 | public string Full { get; set; }
10 |
11 | [JsonProperty("schema_name")]
12 | public string SchemaName { get; set; }
13 |
14 | [JsonProperty("short")]
15 | public string Short { get; set; }
16 |
17 | [JsonProperty("beta")]
18 | public string Beta { get; set; }
19 |
20 | [JsonProperty("normalize")]
21 | public string[] Normalize { get; set; }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/tests/Elastic.CommonSchema.Tests/Repro/GithubIssue29.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using FluentAssertions;
3 | using Xunit;
4 |
5 | namespace Elastic.CommonSchema.Tests.Repro
6 | {
7 | public class GithubIssue29
8 | {
9 | [Fact]
10 | public void Reproduce()
11 | {
12 | // Metadata properties with null values should be serialised
13 | var uniqueName = Guid.NewGuid().ToString();
14 | var root = new EcsDocument
15 | {
16 | Metadata = new MetadataDictionary
17 | {
18 | { uniqueName, null }
19 | }
20 | };
21 |
22 | var serialised = root.Serialize();
23 | serialised.Should().Contain($"\"{uniqueName}\":null");
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/tests-integration/Elastic.Extensions.Logging.IntegrationTests/Elastic.Extensions.Logging.IntegrationTests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 | false
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/tests/Elastic.Apm.Test.Common/NoopPayloadSender.cs:
--------------------------------------------------------------------------------
1 | // Licensed to Elasticsearch B.V under one or more agreements.
2 | // Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3 | // See the LICENSE file in the project root for more information
4 |
5 | using Elastic.Apm.Api;
6 | using Elastic.Apm.Report;
7 |
8 | namespace Elastic.Apm.Test.Common
9 | {
10 | public class NoopPayloadSender : IPayloadSender
11 | {
12 | public void QueueError(IError error) { }
13 |
14 | public void QueueMetrics(IMetricSet metrics) { }
15 |
16 | public void QueueSpan(ISpan span) { }
17 |
18 | public void QueueTransaction(ITransaction transaction) { }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/.github/workflows/bootstrap/action.yml:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bootstrap Checkout
3 | description: Ensures an action that needs to build has access to git tags
4 |
5 | runs:
6 | using: "composite"
7 | steps:
8 | # Ensure we fetch all tags
9 | - shell: bash
10 | run: |
11 | git fetch --prune --unshallow --tags
12 | git tag --list
13 |
14 | # Install .NET version as mandated by global.json
15 | - uses: actions/setup-dotnet@v5
16 | with:
17 | global-json-file: global.json
18 | dotnet-version: |
19 | 6.x
20 | 8.x
21 |
22 | # Setup git config
23 | - uses: elastic/oblt-actions/git/setup@v1
24 |
--------------------------------------------------------------------------------
/docs/reference/intro_to_xyz.md:
--------------------------------------------------------------------------------
1 | ---
2 | mapped_pages:
3 | - https://www.elastic.co/guide/en/ecs-logging/dotnet/current/intro_to_xyz.html
4 | ---
5 |
6 | # A note on the Metadata property [intro_to_xyz]
7 |
8 | The C# `EcsDocument` type includes a property called `Metadata` with the signature:
9 |
10 | ```csharp
11 | ///
12 | /// Container for additional metadata against this event.
13 | ///
14 | [JsonPropertyName("metadata"), DataMember(Name = "metadata")]
15 | public IDictionary Metadata { get; set; }
16 | ```
17 |
18 | This property is not part of the ECS specification, but is included as a means to index supplementary information.
19 |
20 |
--------------------------------------------------------------------------------
/examples/Elastic.Extensions.Logging.Console.Example/Elastic.Extensions.Logging.Console.Example.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net8.0
6 | enable
7 | enable
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/src/Specification/v9.0.0/composable/component/base.json:
--------------------------------------------------------------------------------
1 | {
2 | "_meta": {
3 | "documentation": "https://www.elastic.co/guide/en/ecs/current/ecs-base.html",
4 | "ecs_version": "9.0.0"
5 | },
6 | "template": {
7 | "mappings": {
8 | "properties": {
9 | "@timestamp": {
10 | "type": "date"
11 | },
12 | "labels": {
13 | "type": "object"
14 | },
15 | "message": {
16 | "type": "match_only_text"
17 | },
18 | "tags": {
19 | "ignore_above": 1024,
20 | "synthetic_source_keep": "none",
21 | "type": "keyword"
22 | }
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/Specification/v8.11.0/composable/component/data_stream.json:
--------------------------------------------------------------------------------
1 | {
2 | "_meta": {
3 | "documentation": "https://www.elastic.co/guide/en/ecs/current/ecs-data_stream.html",
4 | "ecs_version": "8.11.0"
5 | },
6 | "template": {
7 | "mappings": {
8 | "properties": {
9 | "data_stream": {
10 | "properties": {
11 | "dataset": {
12 | "type": "constant_keyword"
13 | },
14 | "namespace": {
15 | "type": "constant_keyword"
16 | },
17 | "type": {
18 | "type": "constant_keyword"
19 | }
20 | }
21 | }
22 | }
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/Specification/v8.3.1/composable/component/data_stream.json:
--------------------------------------------------------------------------------
1 | {
2 | "_meta": {
3 | "documentation": "https://www.elastic.co/guide/en/ecs/current/ecs-data_stream.html",
4 | "ecs_version": "8.3.1"
5 | },
6 | "template": {
7 | "mappings": {
8 | "properties": {
9 | "data_stream": {
10 | "properties": {
11 | "dataset": {
12 | "type": "constant_keyword"
13 | },
14 | "namespace": {
15 | "type": "constant_keyword"
16 | },
17 | "type": {
18 | "type": "constant_keyword"
19 | }
20 | }
21 | }
22 | }
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/Specification/v8.4.0/composable/component/data_stream.json:
--------------------------------------------------------------------------------
1 | {
2 | "_meta": {
3 | "documentation": "https://www.elastic.co/guide/en/ecs/current/ecs-data_stream.html",
4 | "ecs_version": "8.4.0"
5 | },
6 | "template": {
7 | "mappings": {
8 | "properties": {
9 | "data_stream": {
10 | "properties": {
11 | "dataset": {
12 | "type": "constant_keyword"
13 | },
14 | "namespace": {
15 | "type": "constant_keyword"
16 | },
17 | "type": {
18 | "type": "constant_keyword"
19 | }
20 | }
21 | }
22 | }
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/Specification/v8.6.0/composable/component/data_stream.json:
--------------------------------------------------------------------------------
1 | {
2 | "_meta": {
3 | "documentation": "https://www.elastic.co/guide/en/ecs/current/ecs-data_stream.html",
4 | "ecs_version": "8.6.0"
5 | },
6 | "template": {
7 | "mappings": {
8 | "properties": {
9 | "data_stream": {
10 | "properties": {
11 | "dataset": {
12 | "type": "constant_keyword"
13 | },
14 | "namespace": {
15 | "type": "constant_keyword"
16 | },
17 | "type": {
18 | "type": "constant_keyword"
19 | }
20 | }
21 | }
22 | }
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/Specification/v9.0.0/composable/component/data_stream.json:
--------------------------------------------------------------------------------
1 | {
2 | "_meta": {
3 | "documentation": "https://www.elastic.co/guide/en/ecs/current/ecs-data_stream.html",
4 | "ecs_version": "9.0.0"
5 | },
6 | "template": {
7 | "mappings": {
8 | "properties": {
9 | "data_stream": {
10 | "properties": {
11 | "dataset": {
12 | "type": "constant_keyword"
13 | },
14 | "namespace": {
15 | "type": "constant_keyword"
16 | },
17 | "type": {
18 | "type": "constant_keyword"
19 | }
20 | }
21 | }
22 | }
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/Elastic.Extensions.Logging/ElasticsearchLoggerOptionsSetup.cs:
--------------------------------------------------------------------------------
1 | // Licensed to Elasticsearch B.V under one or more agreements.
2 | // Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3 | // See the LICENSE file in the project root for more information
4 |
5 | using Elastic.Extensions.Logging.Options;
6 | using Microsoft.Extensions.Logging.Configuration;
7 | using Microsoft.Extensions.Options;
8 |
9 | namespace Elastic.Extensions.Logging;
10 |
11 | internal class ElasticsearchLoggerOptionsSetup(ILoggerProviderConfiguration providerConfiguration)
12 | : ConfigureFromConfigurationOptions(providerConfiguration.Configuration);
13 |
--------------------------------------------------------------------------------
/src/Elastic.NLog.Targets/ElasticPoolType.cs:
--------------------------------------------------------------------------------
1 | using Elastic.Transport;
2 |
3 | namespace NLog.Targets
4 | {
5 | ///
6 | /// The type of connection pool for Elasticsearch
7 | ///
8 | public enum ElasticPoolType
9 | {
10 | /// Not configured
11 | Unknown = 0,
12 | ///
13 | SingleNode,
14 | ///
15 | Sniffing,
16 | ///
17 | Static,
18 | ///
19 | Sticky,
20 | ///
21 | StickySniffing,
22 | ///
23 | Cloud
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/Elastic.Extensions.Logging/Options/DataStreamNameOptions.cs:
--------------------------------------------------------------------------------
1 | namespace Elastic.Extensions.Logging.Options
2 | {
3 | ///
4 | /// Provides options to control the datastream to write Elasticsearch logs too
5 | ///
6 | public class DataStreamNameOptions
7 | {
8 | /// Generic type describing the data. Defaults to 'logs', not recommended to change this
9 | public string Type { get; set; } = "logs";
10 |
11 | /// Describes the data ingested and its structure
12 | public string DataSet { get; set; } = "dotnet";
13 |
14 | /// User-configurable arbitrary grouping
15 | public string Namespace { get; set; } = "default";
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/Elastic.Extensions.Logging/IChannelProvider.cs:
--------------------------------------------------------------------------------
1 | // Licensed to Elasticsearch B.V under one or more agreements.
2 | // Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3 | // See the LICENSE file in the project root for more information
4 |
5 | using Elastic.Channels;
6 |
7 | namespace Elastic.Extensions.Logging
8 | {
9 | ///
10 | /// Instantiates and manages
11 | ///
12 | internal interface IChannelProvider
13 | {
14 | ///
15 | /// Provides instance managed by provider
16 | ///
17 | ///
18 | IBufferedChannel GetChannel();
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/tests-integration/Elastic.NLog.Targets.IntegrationTests/Elastic.NLog.Targets.IntegrationTests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 | false
6 | NLog.Targets.Elastic.IntegrationTests
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/tests-integration/Elasticsearch.IntegrationDefaults/Elasticsearch.IntegrationDefaults.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 | enable
6 | enable
7 | Library
8 | false
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/src/Elastic.CommonSchema.Log4net/Elastic.CommonSchema.Log4net.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0;netstandard2.1;net462;net8.0
5 | Elastic Common Schema (ECS) log4net Layout
6 | log4net Layout that formats log events in accordance with Elastic Common Schema (ECS).
7 | True
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/dotnet-tools.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": 1,
3 | "isRoot": true,
4 | "tools": {
5 | "minver-cli": {
6 | "version": "2.3.1",
7 | "commands": [
8 | "minver"
9 | ],
10 | "rollForward": false
11 | },
12 | "assembly-differ": {
13 | "version": "0.14.0",
14 | "commands": [
15 | "assembly-differ"
16 | ],
17 | "rollForward": false
18 | },
19 | "release-notes": {
20 | "version": "0.6.0",
21 | "commands": [
22 | "release-notes"
23 | ],
24 | "rollForward": false
25 | },
26 | "nupkg-validator": {
27 | "version": "0.7.0",
28 | "commands": [
29 | "nupkg-validator"
30 | ],
31 | "rollForward": false
32 | }
33 | }
34 | }
--------------------------------------------------------------------------------
/src/Specification/v8.11.0/composable/component/group.json:
--------------------------------------------------------------------------------
1 | {
2 | "_meta": {
3 | "documentation": "https://www.elastic.co/guide/en/ecs/current/ecs-group.html",
4 | "ecs_version": "8.11.0"
5 | },
6 | "template": {
7 | "mappings": {
8 | "properties": {
9 | "group": {
10 | "properties": {
11 | "domain": {
12 | "ignore_above": 1024,
13 | "type": "keyword"
14 | },
15 | "id": {
16 | "ignore_above": 1024,
17 | "type": "keyword"
18 | },
19 | "name": {
20 | "ignore_above": 1024,
21 | "type": "keyword"
22 | }
23 | }
24 | }
25 | }
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/Specification/v8.3.1/composable/component/group.json:
--------------------------------------------------------------------------------
1 | {
2 | "_meta": {
3 | "documentation": "https://www.elastic.co/guide/en/ecs/current/ecs-group.html",
4 | "ecs_version": "8.3.1"
5 | },
6 | "template": {
7 | "mappings": {
8 | "properties": {
9 | "group": {
10 | "properties": {
11 | "domain": {
12 | "ignore_above": 1024,
13 | "type": "keyword"
14 | },
15 | "id": {
16 | "ignore_above": 1024,
17 | "type": "keyword"
18 | },
19 | "name": {
20 | "ignore_above": 1024,
21 | "type": "keyword"
22 | }
23 | }
24 | }
25 | }
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/Specification/v8.4.0/composable/component/group.json:
--------------------------------------------------------------------------------
1 | {
2 | "_meta": {
3 | "documentation": "https://www.elastic.co/guide/en/ecs/current/ecs-group.html",
4 | "ecs_version": "8.4.0"
5 | },
6 | "template": {
7 | "mappings": {
8 | "properties": {
9 | "group": {
10 | "properties": {
11 | "domain": {
12 | "ignore_above": 1024,
13 | "type": "keyword"
14 | },
15 | "id": {
16 | "ignore_above": 1024,
17 | "type": "keyword"
18 | },
19 | "name": {
20 | "ignore_above": 1024,
21 | "type": "keyword"
22 | }
23 | }
24 | }
25 | }
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/Specification/v8.6.0/composable/component/group.json:
--------------------------------------------------------------------------------
1 | {
2 | "_meta": {
3 | "documentation": "https://www.elastic.co/guide/en/ecs/current/ecs-group.html",
4 | "ecs_version": "8.6.0"
5 | },
6 | "template": {
7 | "mappings": {
8 | "properties": {
9 | "group": {
10 | "properties": {
11 | "domain": {
12 | "ignore_above": 1024,
13 | "type": "keyword"
14 | },
15 | "id": {
16 | "ignore_above": 1024,
17 | "type": "keyword"
18 | },
19 | "name": {
20 | "ignore_above": 1024,
21 | "type": "keyword"
22 | }
23 | }
24 | }
25 | }
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/Specification/v9.0.0/composable/component/group.json:
--------------------------------------------------------------------------------
1 | {
2 | "_meta": {
3 | "documentation": "https://www.elastic.co/guide/en/ecs/current/ecs-group.html",
4 | "ecs_version": "9.0.0"
5 | },
6 | "template": {
7 | "mappings": {
8 | "properties": {
9 | "group": {
10 | "properties": {
11 | "domain": {
12 | "ignore_above": 1024,
13 | "type": "keyword"
14 | },
15 | "id": {
16 | "ignore_above": 1024,
17 | "type": "keyword"
18 | },
19 | "name": {
20 | "ignore_above": 1024,
21 | "type": "keyword"
22 | }
23 | }
24 | }
25 | }
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/tests/Elastic.Apm.SerilogEnricher.Tests/Elastic.Apm.SerilogEnricher.Tests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net8.0
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/examples/aspnetcore-with-extensions-logging/aspnetcore-with-extensions-logging.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 | enable
6 | enable
7 | aspnetcore_with_extensions_logging
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/tests/Elastic.CommonSchema.Tests/Repro/GithubIssue178.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using FluentAssertions;
3 | using Xunit;
4 |
5 | namespace Elastic.CommonSchema.Tests.Repro
6 | {
7 | public class GithubIssue178
8 | {
9 | [Fact]
10 | public void Reproduce()
11 | {
12 | var x = new EcsDocument
13 | {
14 | Timestamp = DateTime.UtcNow,
15 | Organization = new Organization { Id = Guid.NewGuid().ToString() }
16 | };
17 |
18 | var serialized = x.Serialize();
19 | var deserialized = EcsDocument.Deserialize(serialized);
20 |
21 | deserialized.Should().NotBeNull();
22 | deserialized.Organization.Should().NotBeNull();
23 | deserialized.Organization.Id.Should().NotBeNullOrEmpty();
24 | deserialized.Agent.Should().BeNull();
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/tools/Elastic.CommonSchema.Generator/Views/CodeTemplatePage.cs:
--------------------------------------------------------------------------------
1 | // Licensed to Elasticsearch B.V under one or more agreements.
2 | // Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3 | // See the LICENSE file in the project root for more information
4 |
5 | using System;
6 | using System.Threading.Tasks;
7 | using RazorLight;
8 |
9 | namespace Elastic.CommonSchema.Generator.Views
10 | {
11 | ///
12 | /// This only exists to make the IDE tooling happy, not actually used to render the templates.
13 | ///
14 | public class CodeTemplatePage : TemplatePage
15 | {
16 | public override Task ExecuteAsync() => throw new NotImplementedException();
17 |
18 | public Task Execute() => Task.CompletedTask;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/Elastic.Extensions.Logging/IChannelSetup.cs:
--------------------------------------------------------------------------------
1 | // Licensed to Elasticsearch B.V under one or more agreements.
2 | // Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3 | // See the LICENSE file in the project root for more information
4 |
5 | using Elastic.Ingest.Elasticsearch;
6 |
7 | namespace Elastic.Extensions.Logging
8 | {
9 | ///
10 | /// Provide callbacks to further configure
11 | ///
12 | public interface IChannelSetup
13 | {
14 | ///
15 | /// Provide callbacks to further configure
16 | ///
17 | void ConfigureChannel(ElasticsearchChannelOptionsBase channelOptions);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/tests-integration/Elastic.Ingest.Elasticsearch.CommonSchema.IntegrationTests/IngestionCluster.cs:
--------------------------------------------------------------------------------
1 | // Licensed to Elasticsearch B.V under one or more agreements.
2 | // Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3 | // See the LICENSE file in the project root for more information
4 |
5 | using Elasticsearch.IntegrationDefaults;
6 | using Xunit;
7 |
8 | [assembly: TestFramework("Elastic.Elasticsearch.Xunit.Sdk.ElasticTestFramework", "Elastic.Elasticsearch.Xunit")]
9 |
10 | namespace Elastic.Ingest.Elasticsearch.CommonSchema.IntegrationTests;
11 |
12 | /// Declare our cluster that we want to inject into our test classes
13 | public class IngestionCluster : TestClusterBase
14 | {
15 | public IngestionCluster() : base(9202) { }
16 | }
17 |
--------------------------------------------------------------------------------
/docs/reference/toc.yml:
--------------------------------------------------------------------------------
1 | toc:
2 | - file: index.md
3 | - file: setup.md
4 | - file: ecs-dotnet.md
5 | children:
6 | - file: _usage.md
7 | - file: intro_to_xyz.md
8 | - file: _extending_ecsdocument.md
9 | - file: _formatters.md
10 | children:
11 | - file: serilog-formatter.md
12 | - file: nlog-formatter.md
13 | - file: log4net-formatter.md
14 | - file: data-shippers.md
15 | children:
16 | - file: _elasticsearch_security.md
17 | - file: ecs-ingest-channels.md
18 | - file: serilog-data-shipper.md
19 | - file: extensions-logging-data-shipper.md
20 | - file: benchmark-dotnet-data-shipper.md
21 | - file: _enrichers_2.md
22 | children:
23 | - file: apm-serilog-enricher.md
24 | - file: apm-nlog-enricher.md
--------------------------------------------------------------------------------
/examples/console-with-extensions-logging/console-with-extensions-logging.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net8.0
6 | latest
7 | enable
8 |
9 |
10 |
11 |
12 | PreserveNewest
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/tests-integration/Elastic.Ingest.Elasticsearch.CommonSchema.IntegrationTests/IntegrationTestBase.cs:
--------------------------------------------------------------------------------
1 | // Licensed to Elasticsearch B.V under one or more agreements.
2 | // Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3 | // See the LICENSE file in the project root for more information
4 |
5 | using Elastic.Clients.Elasticsearch;
6 | using Elastic.Elasticsearch.Xunit.XunitPlumbing;
7 | using Xunit.Abstractions;
8 |
9 | namespace Elastic.Ingest.Elasticsearch.CommonSchema.IntegrationTests;
10 |
11 | public abstract class IntegrationTestBase : IClusterFixture
12 | {
13 | protected ElasticsearchClient Client { get; }
14 |
15 | protected IntegrationTestBase(IngestionCluster cluster, ITestOutputHelper output) =>
16 | Client = cluster.CreateClient(output);
17 | }
18 |
--------------------------------------------------------------------------------
/src/Specification/v8.11.0/composable/component/organization.json:
--------------------------------------------------------------------------------
1 | {
2 | "_meta": {
3 | "documentation": "https://www.elastic.co/guide/en/ecs/current/ecs-organization.html",
4 | "ecs_version": "8.11.0"
5 | },
6 | "template": {
7 | "mappings": {
8 | "properties": {
9 | "organization": {
10 | "properties": {
11 | "id": {
12 | "ignore_above": 1024,
13 | "type": "keyword"
14 | },
15 | "name": {
16 | "fields": {
17 | "text": {
18 | "type": "match_only_text"
19 | }
20 | },
21 | "ignore_above": 1024,
22 | "type": "keyword"
23 | }
24 | }
25 | }
26 | }
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/Specification/v8.3.1/composable/component/organization.json:
--------------------------------------------------------------------------------
1 | {
2 | "_meta": {
3 | "documentation": "https://www.elastic.co/guide/en/ecs/current/ecs-organization.html",
4 | "ecs_version": "8.3.1"
5 | },
6 | "template": {
7 | "mappings": {
8 | "properties": {
9 | "organization": {
10 | "properties": {
11 | "id": {
12 | "ignore_above": 1024,
13 | "type": "keyword"
14 | },
15 | "name": {
16 | "fields": {
17 | "text": {
18 | "type": "match_only_text"
19 | }
20 | },
21 | "ignore_above": 1024,
22 | "type": "keyword"
23 | }
24 | }
25 | }
26 | }
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/Specification/v8.4.0/composable/component/organization.json:
--------------------------------------------------------------------------------
1 | {
2 | "_meta": {
3 | "documentation": "https://www.elastic.co/guide/en/ecs/current/ecs-organization.html",
4 | "ecs_version": "8.4.0"
5 | },
6 | "template": {
7 | "mappings": {
8 | "properties": {
9 | "organization": {
10 | "properties": {
11 | "id": {
12 | "ignore_above": 1024,
13 | "type": "keyword"
14 | },
15 | "name": {
16 | "fields": {
17 | "text": {
18 | "type": "match_only_text"
19 | }
20 | },
21 | "ignore_above": 1024,
22 | "type": "keyword"
23 | }
24 | }
25 | }
26 | }
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/Specification/v8.6.0/composable/component/organization.json:
--------------------------------------------------------------------------------
1 | {
2 | "_meta": {
3 | "documentation": "https://www.elastic.co/guide/en/ecs/current/ecs-organization.html",
4 | "ecs_version": "8.6.0"
5 | },
6 | "template": {
7 | "mappings": {
8 | "properties": {
9 | "organization": {
10 | "properties": {
11 | "id": {
12 | "ignore_above": 1024,
13 | "type": "keyword"
14 | },
15 | "name": {
16 | "fields": {
17 | "text": {
18 | "type": "match_only_text"
19 | }
20 | },
21 | "ignore_above": 1024,
22 | "type": "keyword"
23 | }
24 | }
25 | }
26 | }
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/Specification/v9.0.0/composable/component/organization.json:
--------------------------------------------------------------------------------
1 | {
2 | "_meta": {
3 | "documentation": "https://www.elastic.co/guide/en/ecs/current/ecs-organization.html",
4 | "ecs_version": "9.0.0"
5 | },
6 | "template": {
7 | "mappings": {
8 | "properties": {
9 | "organization": {
10 | "properties": {
11 | "id": {
12 | "ignore_above": 1024,
13 | "type": "keyword"
14 | },
15 | "name": {
16 | "fields": {
17 | "text": {
18 | "type": "match_only_text"
19 | }
20 | },
21 | "ignore_above": 1024,
22 | "type": "keyword"
23 | }
24 | }
25 | }
26 | }
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/tests-integration/Elastic.CommonSchema.BenchmarkDotNetExporter.IntegrationTests/Md5VsSha256.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Security.Cryptography;
3 | using BenchmarkDotNet.Attributes;
4 |
5 | namespace Elastic.CommonSchema.BenchmarkDotNetExporter.IntegrationTests
6 | {
7 | public class Md5VsSha256
8 | {
9 | private readonly SHA256 _sha256 = SHA256.Create();
10 | private readonly MD5 _md5 = MD5.Create();
11 | private byte[] _data;
12 |
13 | [Params(1000, 10000)]
14 | public int N;
15 |
16 | [GlobalSetup]
17 | public void Setup()
18 | {
19 | _data = new byte[N];
20 | new Random(42).NextBytes(_data);
21 | }
22 |
23 | [Benchmark]
24 | public byte[] Sha256() => _sha256.ComputeHash(_data);
25 |
26 | [Benchmark]
27 | public byte[] Md5() => _md5.ComputeHash(_data);
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for this project
4 | title: "[FEATURE]"
5 | labels: enhancement
6 | assignees: ''
7 |
8 | ---
9 |
10 | **ECS integration/library project(s) (e.g. Elastic.CommonSchema.Serilog)**:
11 |
12 | **Is your feature request related to a problem? Please describe.**
13 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
14 |
15 | **Describe the solution you'd like**
16 | A clear and concise description of what you want to happen.
17 |
18 | **Describe alternatives you've considered**
19 | A clear and concise description of any alternative solutions or features you've considered.
20 |
21 | **Additional context**
22 | Add any other context or screenshots about the feature request here.
23 |
--------------------------------------------------------------------------------
/src/Elastic.CommonSchema.NLog/Elastic.CommonSchema.NLog.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0;netstandard2.1;net462;net8.0
5 | Elastic Common Schema (ECS) NLog Layout
6 | NLog Layout that formats log events in accordance with Elastic Common Schema (ECS).
7 | True
8 | true
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/src/Elastic.Extensions.Logging/Options/IndexNameOptions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Elastic.Extensions.Logging.Options
4 | {
5 | ///
6 | /// Provides options to configure the naming of the index name to write too.
7 | ///
8 | public class IndexNameOptions
9 | {
10 | ///
11 | /// Gets or sets the format string for the Elastic search index. The current DateTimeOffset is passed as parameter
12 | /// 0.
13 | ///
14 | public string Format { get; set; } = "dotnet-{0:yyyy.MM.dd}";
15 |
16 | ///
17 | /// Gets or sets the offset to use for the index DateTimeOffset. Default value is null, which uses the system local
18 | /// offset. Use "00:00" for UTC.
19 | ///
20 | public TimeSpan? IndexOffset { get; set; }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/tests-integration/Elastic.Ingest.Elasticsearch.CommonSchema.IntegrationTests/Elastic.Ingest.Elasticsearch.CommonSchema.IntegrationTests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 | enable
6 | enable
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/src/Elastic.CommonSchema.Serilog/Elastic.CommonSchema.Serilog.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | netstandard2.0;netstandard2.1;net462;net8.0
6 | Elastic Common Schema (ECS) Serilog Formatter
7 | Serilog TextFormatter that formats log events in accordance with Elastic Common Schema (ECS).
8 | True
9 | enable
10 | latest
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/src/Specification/v8.3.1/composable/component/related.json:
--------------------------------------------------------------------------------
1 | {
2 | "_meta": {
3 | "documentation": "https://www.elastic.co/guide/en/ecs/current/ecs-related.html",
4 | "ecs_version": "8.3.1"
5 | },
6 | "template": {
7 | "mappings": {
8 | "properties": {
9 | "related": {
10 | "properties": {
11 | "hash": {
12 | "ignore_above": 1024,
13 | "type": "keyword"
14 | },
15 | "hosts": {
16 | "ignore_above": 1024,
17 | "type": "keyword"
18 | },
19 | "ip": {
20 | "type": "ip"
21 | },
22 | "user": {
23 | "ignore_above": 1024,
24 | "type": "keyword"
25 | }
26 | }
27 | }
28 | }
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/Specification/v8.4.0/composable/component/related.json:
--------------------------------------------------------------------------------
1 | {
2 | "_meta": {
3 | "documentation": "https://www.elastic.co/guide/en/ecs/current/ecs-related.html",
4 | "ecs_version": "8.4.0"
5 | },
6 | "template": {
7 | "mappings": {
8 | "properties": {
9 | "related": {
10 | "properties": {
11 | "hash": {
12 | "ignore_above": 1024,
13 | "type": "keyword"
14 | },
15 | "hosts": {
16 | "ignore_above": 1024,
17 | "type": "keyword"
18 | },
19 | "ip": {
20 | "type": "ip"
21 | },
22 | "user": {
23 | "ignore_above": 1024,
24 | "type": "keyword"
25 | }
26 | }
27 | }
28 | }
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/Specification/v8.6.0/composable/component/related.json:
--------------------------------------------------------------------------------
1 | {
2 | "_meta": {
3 | "documentation": "https://www.elastic.co/guide/en/ecs/current/ecs-related.html",
4 | "ecs_version": "8.6.0"
5 | },
6 | "template": {
7 | "mappings": {
8 | "properties": {
9 | "related": {
10 | "properties": {
11 | "hash": {
12 | "ignore_above": 1024,
13 | "type": "keyword"
14 | },
15 | "hosts": {
16 | "ignore_above": 1024,
17 | "type": "keyword"
18 | },
19 | "ip": {
20 | "type": "ip"
21 | },
22 | "user": {
23 | "ignore_above": 1024,
24 | "type": "keyword"
25 | }
26 | }
27 | }
28 | }
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/Elastic.CommonSchema.BenchmarkDotNetExporter/Domain/BenchmarkSimplifiedWorkloadCounts.cs:
--------------------------------------------------------------------------------
1 | // Licensed to Elasticsearch B.V under one or more agreements.
2 | // Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3 | // See the LICENSE file in the project root for more information
4 |
5 | using System.Runtime.Serialization;
6 | using System.Text.Json.Serialization;
7 |
8 | namespace Elastic.CommonSchema.BenchmarkDotNetExporter.Domain
9 | {
10 | ///
11 | public class BenchmarkSimplifiedWorkloadCounts
12 | {
13 | ///
14 | [JsonPropertyName("warmup"), DataMember(Name = "warmup")]
15 | public long Warmup { get; set; }
16 |
17 | ///
18 | [JsonPropertyName("measured"), DataMember(Name = "measured")]
19 | public long Measured { get; set; }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/Specification/v8.11.0/composable/component/related.json:
--------------------------------------------------------------------------------
1 | {
2 | "_meta": {
3 | "documentation": "https://www.elastic.co/guide/en/ecs/current/ecs-related.html",
4 | "ecs_version": "8.11.0"
5 | },
6 | "template": {
7 | "mappings": {
8 | "properties": {
9 | "related": {
10 | "properties": {
11 | "hash": {
12 | "ignore_above": 1024,
13 | "type": "keyword"
14 | },
15 | "hosts": {
16 | "ignore_above": 1024,
17 | "type": "keyword"
18 | },
19 | "ip": {
20 | "type": "ip"
21 | },
22 | "user": {
23 | "ignore_above": 1024,
24 | "type": "keyword"
25 | }
26 | }
27 | }
28 | }
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/tests-integration/Elastic.Serilog.Sinks.IntegrationTests/Elastic.Serilog.Sinks.IntegrationTests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 | latest
6 | False
7 | enable
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/.github/workflows/test-reporter.yml:
--------------------------------------------------------------------------------
1 | ---
2 | ## Workflow to process the JUnit test results and add a report to the checks.
3 | name: test-reporter
4 | on:
5 | workflow_run:
6 | workflows:
7 | - test
8 | types:
9 | - completed
10 |
11 | permissions:
12 | contents: read
13 | actions: read
14 | checks: write
15 |
16 | jobs:
17 | report:
18 | runs-on: ubuntu-latest
19 | steps:
20 | - uses: elastic/oblt-actions/test-report@v1
21 | with:
22 | artifact: /test-results(.*)/ # artifact name pattern
23 | name: 'Test Report $1' # Name of the check run which will be created
24 | path: "junit-*.xml" # Path to test results (inside artifact .zip)
25 | reporter: java-junit # Format of test results
26 | list-suites: 'failed'
27 | list-tests: 'failed'
28 |
--------------------------------------------------------------------------------
/src/Elastic.Apm.NLog/ApmSpanIdLayoutRenderer.cs:
--------------------------------------------------------------------------------
1 | using System.Text;
2 | using NLog;
3 | using NLog.Config;
4 | using NLog.LayoutRenderers;
5 |
6 | namespace Elastic.Apm.NLog;
7 |
8 | ///
9 | /// Provides ElasticApmSpanId as special logging variable to render the current Elastic APM Span Id
10 | ///
11 | [LayoutRenderer(Name)]
12 | public class ApmSpanIdLayoutRenderer : LayoutRenderer
13 | {
14 | ///
15 | /// ElasticApmSpanId - the variable to use to inject into your logs
16 | ///
17 | public const string Name = "ElasticApmSpanId";
18 |
19 | ///
20 | protected override void Append(StringBuilder builder, LogEventInfo logEvent)
21 | {
22 | if (!Agent.IsConfigured) return;
23 | if (!Agent.Config.Enabled) return;
24 | builder.Append(Agent.Tracer?.CurrentSpan?.Id);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/Elastic.NLog.Targets/Elastic.NLog.Targets.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0;netstandard2.1;net8.0
5 | Elasticsearch NLog Target
6 | NLog Target that exports directly to Elastic Cloud or individual Elasticsearch nodes
7 | NLog.Targets
8 | True
9 | enable
10 | true
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/tests/Elastic.Apm.Disabled.Serilog.Tests/Elastic.Apm.Disabled.Serilog.Tests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 | enable
6 | enable
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/tests/Elastic.CommonSchema.Log4net.Tests/TestAppender.cs:
--------------------------------------------------------------------------------
1 | // Licensed to Elasticsearch B.V under one or more agreements.
2 | // Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3 | // See the LICENSE file in the project root for more information
4 |
5 | using System.Collections.Generic;
6 | using System.IO;
7 | using log4net.Appender;
8 | using log4net.Core;
9 |
10 | namespace Elastic.CommonSchema.Log4net.Tests;
11 |
12 | internal class TestAppender : AppenderSkeleton
13 | {
14 | public List Events { get; } = new();
15 |
16 | protected override void Append(LoggingEvent loggingEvent)
17 | {
18 | using var writer = new StringWriter();
19 |
20 |
21 | if (Layout == null)
22 | loggingEvent.WriteRenderedMessage(writer);
23 | else
24 | Layout.Format(writer, loggingEvent);
25 |
26 | Events.Add(writer.ToString());
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/tests/Elastic.Apm.Test.Common/TestApmAgent.cs:
--------------------------------------------------------------------------------
1 | namespace Elastic.Apm.Test.Common;
2 |
3 | public static class TestApmAgent
4 | {
5 | static TestApmAgent()
6 | {
7 | var configuration = new MockConfiguration("my-service", "my-service-node-name", "0.2.1", enabled: true);
8 | if (!Agent.IsConfigured)
9 | Agent.Setup(new AgentComponents(payloadSender: new NoopPayloadSender(), configurationReader: configuration));
10 | }
11 |
12 | public static void Configure() { }
13 | }
14 |
15 | public static class TestDisabledApmAgent
16 | {
17 | static TestDisabledApmAgent()
18 | {
19 | var configuration = new MockConfiguration("my-service", "my-service-node-name", "0.2.1", enabled: false);
20 | if (!Agent.IsConfigured)
21 | Agent.Setup(new AgentComponents(payloadSender: new NoopPayloadSender(), configurationReader: configuration));
22 | }
23 | public static void Configure() { }
24 | }
25 |
--------------------------------------------------------------------------------
/src/Elastic.Apm.NLog/ApmServiceVersionLayoutRenderer.cs:
--------------------------------------------------------------------------------
1 | using System.Text;
2 | using NLog;
3 | using NLog.Config;
4 | using NLog.LayoutRenderers;
5 |
6 | namespace Elastic.Apm.NLog;
7 |
8 | ///
9 | /// Provides ElasticApmServiceVersion as special logging variable to render the current Elastic APM Service Version
10 | ///
11 | [LayoutRenderer(Name)]
12 | [ThreadAgnostic]
13 | public class ApmServiceVersionLayoutRenderer : LayoutRenderer
14 | {
15 | ///
16 | /// ElasticApmServiceVersion - the variable to use to inject into your logs
17 | ///
18 | public const string Name = "ElasticApmServiceVersion";
19 |
20 | ///
21 | protected override void Append(StringBuilder builder, LogEventInfo logEvent)
22 | {
23 | if (!Agent.IsConfigured) return;
24 | builder.Append(Agent.Config.ServiceVersion);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/Elastic.CommonSchema.BenchmarkDotNetExporter/Elastic.CommonSchema.BenchmarkDotNetExporter.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | netstandard2.0;netstandard2.1
4 | true
5 | Elastic Common Schema (ECS) BenchmarkDotNet exporter
6 | Exports BenchmarkDotNet benchmarks to Elasticsearch using Elastic Common Schema (ECS) format
7 | latest
8 | True
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/src/Elastic.Extensions.Logging.Console/README.md:
--------------------------------------------------------------------------------
1 | # Elastic.Extensions.Logging.Console
2 |
3 | This package includes formatters and extension methods for `Microsoft.Extensions.Logging.Console` to make it easy to write ECS formatted logs to consoleoutput.
4 |
5 | May be used with `Elastic.Extensions.Logging` to write ECS documents directly to Elasticsearch / Elastic Cloud.
6 |
7 |
8 | ## Usage
9 |
10 | The console logging provider and formatter can be set up using a simple extension method.
11 |
12 | ```csharp
13 | .ConfigureLogging((_, loggingBuilder) => loggingBuilder.AddEcsConsole())
14 | ```
15 |
16 | Or indirectly using the types provided in this package:
17 |
18 | ```csharp
19 | .ConfigureLogging((_, loggingBuilder) =>
20 | {
21 | loggingBuilder.AddConsole(c=> c.FormatterName = "ecs");
22 | loggingBuilder.AddConsoleFormatter();
23 | })
24 | ```
--------------------------------------------------------------------------------
/src/Elastic.Apm.NLog/ApmServiceNodeNameLayoutRenderer.cs:
--------------------------------------------------------------------------------
1 | using System.Text;
2 | using NLog;
3 | using NLog.Config;
4 | using NLog.LayoutRenderers;
5 |
6 | namespace Elastic.Apm.NLog;
7 |
8 | ///
9 | /// Provides ElasticApmServiceNodeName as special logging variable to render the current Elastic APM Service Node Name
10 | ///
11 | [LayoutRenderer(Name)]
12 | [ThreadAgnostic]
13 | public class ApmServiceNodeNameLayoutRenderer : LayoutRenderer
14 | {
15 | ///
16 | /// ElasticApmServiceNodeName - the variable to use to inject into your logs
17 | ///
18 | public const string Name = "ElasticApmServiceNodeName";
19 |
20 | ///
21 | protected override void Append(StringBuilder builder, LogEventInfo logEvent)
22 | {
23 | if (!Agent.IsConfigured) return;
24 |
25 | builder.Append(Agent.Config.ServiceNodeName);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/examples/Elastic.Extensions.Logging.Console.Example/ExampleService.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Extensions.Hosting;
2 | using Microsoft.Extensions.Logging;
3 |
4 | namespace Elastic.Extensions.Logging.Console.Example;
5 |
6 | /// Simulate work that logs in low volume with some time in between each log call
7 | public class ExampleService : BackgroundService
8 | {
9 | private readonly ILogger _logger;
10 |
11 | public ExampleService(ILogger logger) => _logger = logger;
12 |
13 | protected override async Task ExecuteAsync(CancellationToken ctx)
14 | {
15 | for (var i = 0; i < 100; i++)
16 | {
17 | if (i % 10 == 0)
18 | _logger.LogWarning("We are logging way too much: {CustomData}", i);
19 | else
20 | _logger.LogInformation("We are logging way too much: {CustomData}", i);
21 | if (i % 100 == 0)
22 | await Task.Delay(1, ctx);
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/examples/Elastic.Extensions.Logging.Example/HighVolumeWorkSimulation.cs:
--------------------------------------------------------------------------------
1 | using System.Threading;
2 | using System.Threading.Tasks;
3 | using Microsoft.Extensions.Hosting;
4 | using Microsoft.Extensions.Logging;
5 |
6 | namespace Elastic.Extensions.Logging.Example
7 | {
8 |
9 | /// Simulate work that logs in low volume with some time in between each log call
10 | public class HighVolumeWorkSimulation : BackgroundService
11 | {
12 | private readonly ILogger _logger;
13 |
14 | public HighVolumeWorkSimulation(ILogger logger) => _logger = logger;
15 |
16 | protected override async Task ExecuteAsync(CancellationToken ctx)
17 | {
18 | for (var i = 0; i < 100_000; i++)
19 | {
20 | _logger.LogWarning($"We are logging way too much: {i}");
21 | if (i % 100 == 0)
22 | await Task.Delay(1, ctx);
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/tests-integration/Elastic.Ingest.Elasticsearch.CommonSchema.IntegrationTests/CustomEventWriter.cs:
--------------------------------------------------------------------------------
1 | using System.Buffers;
2 | using System.Text.Json;
3 | using System.Text.Json.Serialization;
4 |
5 | namespace Elastic.Ingest.Elasticsearch.CommonSchema.IntegrationTests;
6 |
7 | public class CustomEventWriter : IElasticsearchEventWriter
8 | {
9 | // ReSharper disable once StaticMemberInGenericType
10 | private static readonly JsonSerializerOptions s_serializerOptions = new() { Converters = { new JsonStringEnumConverter() } };
11 |
12 | public Action, T>? WriteToArrayBuffer
13 | {
14 | get => throw new NotImplementedException();
15 | set => throw new NotImplementedException();
16 | }
17 |
18 | public Func? WriteToStreamAsync { get; set; } =
19 | (stream, doc, ctx) => JsonSerializer.SerializeAsync(stream, doc, s_serializerOptions, ctx);
20 | }
21 |
--------------------------------------------------------------------------------
/tests/Elastic.Apm.NLog.Tests/Elastic.Apm.NLog.Tests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/tests/Elastic.CommonSchema.Tests/Repro/GithubIssue438.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using FluentAssertions;
3 | using Xunit;
4 |
5 | namespace Elastic.CommonSchema.Tests.Repro
6 | {
7 | public class GithubIssue438
8 | {
9 | [Fact]
10 | public void Reproduce()
11 | {
12 | // language=json
13 | var json =
14 | """
15 | {
16 | "@timestamp":"2022-11-08T09:36:37.249Z",
17 | "log.level":"info",
18 | "message":"['vo_phi_pkg\\\\runtime_recon.py']",
19 | "ecs":{"version":"1.6.0"},
20 | "log":{
21 | "logger":"root",
22 | "origin":{"file":{"line":90,"name":"main.py"},"function":"prepare_logging"},
23 | "original":"['vo_phi_pkg\\\\runtime_recon.py']"},
24 | "process":{"name":"MainProcess","pid":35436,"thread":{"id":13180,"name":"MainThread"}}
25 | }
26 | """;
27 | var entry1 = System.Text.Json.JsonSerializer.Deserialize(json);
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve
4 | title: "[BUG]"
5 | labels: bug
6 | assignees: ''
7 |
8 | ---
9 |
10 |
17 |
18 | **ECS integration/library project(s) (e.g. Elastic.CommonSchema.Serilog)**:
19 |
20 | **ECS schema version (e.g. 1.4.0)**:
21 |
22 | **ECS .NET assembly version (e.g. 1.4.2)**:
23 |
24 | **Elasticsearch version (if applicable)**:
25 |
26 | **.NET framework / OS**:
27 |
28 | **Description of the problem, including expected versus actual behavior**:
29 |
30 | **Steps to reproduce**:
31 | 1.
32 | 2.
33 | 3.
34 |
--------------------------------------------------------------------------------
/src/Specification/v8.11.0/composable/component/tracing.json:
--------------------------------------------------------------------------------
1 | {
2 | "_meta": {
3 | "documentation": "https://www.elastic.co/guide/en/ecs/current/ecs-tracing.html",
4 | "ecs_version": "8.11.0"
5 | },
6 | "template": {
7 | "mappings": {
8 | "properties": {
9 | "span": {
10 | "properties": {
11 | "id": {
12 | "ignore_above": 1024,
13 | "type": "keyword"
14 | }
15 | }
16 | },
17 | "trace": {
18 | "properties": {
19 | "id": {
20 | "ignore_above": 1024,
21 | "type": "keyword"
22 | }
23 | }
24 | },
25 | "transaction": {
26 | "properties": {
27 | "id": {
28 | "ignore_above": 1024,
29 | "type": "keyword"
30 | }
31 | }
32 | }
33 | }
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/Specification/v8.3.1/composable/component/tracing.json:
--------------------------------------------------------------------------------
1 | {
2 | "_meta": {
3 | "documentation": "https://www.elastic.co/guide/en/ecs/current/ecs-tracing.html",
4 | "ecs_version": "8.3.1"
5 | },
6 | "template": {
7 | "mappings": {
8 | "properties": {
9 | "span": {
10 | "properties": {
11 | "id": {
12 | "ignore_above": 1024,
13 | "type": "keyword"
14 | }
15 | }
16 | },
17 | "trace": {
18 | "properties": {
19 | "id": {
20 | "ignore_above": 1024,
21 | "type": "keyword"
22 | }
23 | }
24 | },
25 | "transaction": {
26 | "properties": {
27 | "id": {
28 | "ignore_above": 1024,
29 | "type": "keyword"
30 | }
31 | }
32 | }
33 | }
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/Specification/v8.4.0/composable/component/tracing.json:
--------------------------------------------------------------------------------
1 | {
2 | "_meta": {
3 | "documentation": "https://www.elastic.co/guide/en/ecs/current/ecs-tracing.html",
4 | "ecs_version": "8.4.0"
5 | },
6 | "template": {
7 | "mappings": {
8 | "properties": {
9 | "span": {
10 | "properties": {
11 | "id": {
12 | "ignore_above": 1024,
13 | "type": "keyword"
14 | }
15 | }
16 | },
17 | "trace": {
18 | "properties": {
19 | "id": {
20 | "ignore_above": 1024,
21 | "type": "keyword"
22 | }
23 | }
24 | },
25 | "transaction": {
26 | "properties": {
27 | "id": {
28 | "ignore_above": 1024,
29 | "type": "keyword"
30 | }
31 | }
32 | }
33 | }
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/Specification/v8.6.0/composable/component/tracing.json:
--------------------------------------------------------------------------------
1 | {
2 | "_meta": {
3 | "documentation": "https://www.elastic.co/guide/en/ecs/current/ecs-tracing.html",
4 | "ecs_version": "8.6.0"
5 | },
6 | "template": {
7 | "mappings": {
8 | "properties": {
9 | "span": {
10 | "properties": {
11 | "id": {
12 | "ignore_above": 1024,
13 | "type": "keyword"
14 | }
15 | }
16 | },
17 | "trace": {
18 | "properties": {
19 | "id": {
20 | "ignore_above": 1024,
21 | "type": "keyword"
22 | }
23 | }
24 | },
25 | "transaction": {
26 | "properties": {
27 | "id": {
28 | "ignore_above": 1024,
29 | "type": "keyword"
30 | }
31 | }
32 | }
33 | }
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/Specification/v9.0.0/composable/component/tracing.json:
--------------------------------------------------------------------------------
1 | {
2 | "_meta": {
3 | "documentation": "https://www.elastic.co/guide/en/ecs/current/ecs-tracing.html",
4 | "ecs_version": "9.0.0"
5 | },
6 | "template": {
7 | "mappings": {
8 | "properties": {
9 | "span": {
10 | "properties": {
11 | "id": {
12 | "ignore_above": 1024,
13 | "type": "keyword"
14 | }
15 | }
16 | },
17 | "trace": {
18 | "properties": {
19 | "id": {
20 | "ignore_above": 1024,
21 | "type": "keyword"
22 | }
23 | }
24 | },
25 | "transaction": {
26 | "properties": {
27 | "id": {
28 | "ignore_above": 1024,
29 | "type": "keyword"
30 | }
31 | }
32 | }
33 | }
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/tools/Elastic.CommonSchema.Generator/Schema/DTO/FieldAllowedValue.cs:
--------------------------------------------------------------------------------
1 | // Licensed to Elasticsearch B.V under one or more agreements.
2 | // Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3 | // See the LICENSE file in the project root for more information
4 |
5 | using Newtonsoft.Json;
6 |
7 | namespace Elastic.CommonSchema.Generator.Schema.DTO
8 | {
9 | public class FieldAllowedValue
10 | {
11 | ///
12 | /// Name of the allowed value.
13 | ///
14 | [JsonProperty("name")]
15 | public string Name { get; set; }
16 |
17 | ///
18 | /// Description of the allowed value.
19 | ///
20 | [JsonProperty("description")]
21 | public string Description { get; set; }
22 |
23 | ///
24 | /// List of allowed values.
25 | ///
26 | [JsonProperty("expected_event_types")]
27 | public string[] ExpectedEventTypes { get; set; }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/Elastic.Extensions.Logging/Options/NodePoolType.cs:
--------------------------------------------------------------------------------
1 | // Licensed to Elasticsearch B.V under one or more agreements.
2 | // Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3 | // See the LICENSE file in the project root for more information
4 |
5 | using Elastic.Transport;
6 |
7 | namespace Elastic.Extensions.Logging.Options
8 | {
9 | ///
10 | /// The type of connection pool to use
11 | ///
12 | public enum NodePoolType
13 | {
14 | /// Not configured
15 | Unknown = 0,
16 | ///
17 | SingleNode,
18 | ///
19 | Sniffing,
20 | ///
21 | Static,
22 | ///
23 | Sticky,
24 | ///
25 | StickySniffing,
26 | ///
27 | Cloud
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/examples/Elastic.Extensions.Logging.Example/Elastic.Extensions.Logging.Example.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net8.0
6 | latest
7 | enable
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 | PreserveNewest
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/issue_template.md:
--------------------------------------------------------------------------------
1 |
8 |
9 |
13 |
14 | **ECS version**:
15 |
16 | **Elasticsearch version (if applicable)**:
17 |
18 | **.NET framework / OS**:
19 |
20 | **Description of the problem, including expected versus actual behavior**:
21 |
22 | **Steps to reproduce**:
23 | 1.
24 | 2.
25 | 3.
26 |
27 |
31 |
32 | **Describe the feature**:
--------------------------------------------------------------------------------
/src/Elastic.Extensions.Logging/InternalChannelSetup.cs:
--------------------------------------------------------------------------------
1 | // Licensed to Elasticsearch B.V under one or more agreements.
2 | // Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3 | // See the LICENSE file in the project root for more information
4 |
5 | using System;
6 | using Elastic.Ingest.Elasticsearch;
7 |
8 | namespace Elastic.Extensions.Logging
9 | {
10 | ///
11 | public class ChannelSetup : IChannelSetup
12 | {
13 | private readonly Action> _configureChannel;
14 |
15 | ///
16 | public ChannelSetup(Action> configureChannel) => _configureChannel = configureChannel;
17 |
18 | ///
19 | public void ConfigureChannel(ElasticsearchChannelOptionsBase channelOptions) =>
20 | _configureChannel(channelOptions);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Elastic.Apm.NLog/Elastic.Apm.NLog.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | netstandard2.0;net462;net8.0
4 | Elastic APM NLog Layout Renderers
5 | Enrich NLog log messages with APM TraceId and TransactionId.
6 | True
7 |
8 |
9 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/src/Elastic.CommonSchema/Entities.ShouldSerialize.Generated.cs:
--------------------------------------------------------------------------------
1 | // Licensed to Elasticsearch B.V under one or more agreements.
2 | // Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3 | // See the LICENSE file in the project root for more information
4 |
5 | /*
6 | IMPORTANT NOTE
7 | ==============
8 | This file has been generated.
9 | If you wish to submit a PR please modify the original csharp file and submit the PR with that change. Thanks!
10 | */
11 |
12 | using System;
13 | using System.Collections.Generic;
14 | using System.Text.Json;
15 | using System.Text.Json.Serialization;
16 |
17 | namespace Elastic.CommonSchema;
18 |
19 | public partial class Log
20 | {
21 | [JsonIgnore]
22 | internal bool ShouldSerialize =>
23 | FilePath != null || Logger != null || OriginFileLine != null || OriginFileName != null || OriginFunction != null;
24 | }
25 | public partial class Ecs
26 | {
27 | [JsonIgnore]
28 | internal bool ShouldSerialize =>
29 | false;
30 | }
31 |
--------------------------------------------------------------------------------
/src/Elastic.Extensions.Logging.Common/Elastic.Extensions.Logging.Common.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0;netstandard2.1;net8.0
5 | Common Abstactions For ECS For Microsoft.Extensions.Logging
6 | Transient dependency, do not install directly. Common Abstactions For ECS For Microsoft.Extensions.Logging
7 | Logging;LoggerProvider;Elasticsearch;Console;ELK;Kibana;Logstash;Tracing;Diagnostics;Log;Trace;ECS
8 | enable
9 | enable
10 | True
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/src/Specification/v9.0.0/composable/component/related.json:
--------------------------------------------------------------------------------
1 | {
2 | "_meta": {
3 | "documentation": "https://www.elastic.co/guide/en/ecs/current/ecs-related.html",
4 | "ecs_version": "9.0.0"
5 | },
6 | "template": {
7 | "mappings": {
8 | "properties": {
9 | "related": {
10 | "properties": {
11 | "hash": {
12 | "ignore_above": 1024,
13 | "synthetic_source_keep": "none",
14 | "type": "keyword"
15 | },
16 | "hosts": {
17 | "ignore_above": 1024,
18 | "synthetic_source_keep": "none",
19 | "type": "keyword"
20 | },
21 | "ip": {
22 | "type": "ip"
23 | },
24 | "user": {
25 | "ignore_above": 1024,
26 | "synthetic_source_keep": "none",
27 | "type": "keyword"
28 | }
29 | }
30 | }
31 | }
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/tools/Elastic.CommonSchema.Generator/Schema/EcsSchema.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Elastic.CommonSchema.Generator.Schema.DTO;
3 |
4 | namespace Elastic.CommonSchema.Generator.Schema;
5 |
6 | public class EcsSchema
7 | {
8 | public IReadOnlyCollection Warnings { get; }
9 | public IReadOnlyDictionary Templates { get; }
10 | public IReadOnlyDictionary Components { get; }
11 | public string GitRef { get; }
12 | public string Version { get; }
13 | public IReadOnlyCollection