![]() |
VOOZH | about |
dotnet add package Elastic.CommonSchema.NLog --version 9.0.0
NuGet\Install-Package Elastic.CommonSchema.NLog -Version 9.0.0
<PackageReference Include="Elastic.CommonSchema.NLog" Version="9.0.0" />
<PackageVersion Include="Elastic.CommonSchema.NLog" Version="9.0.0" />Directory.Packages.props
<PackageReference Include="Elastic.CommonSchema.NLog" />Project file
paket add Elastic.CommonSchema.NLog --version 9.0.0
#r "nuget: Elastic.CommonSchema.NLog, 9.0.0"
#:package Elastic.CommonSchema.NLog@9.0.0
#addin nuget:?package=Elastic.CommonSchema.NLog&version=9.0.0Install as a Cake Addin
#tool nuget:?package=Elastic.CommonSchema.NLog&version=9.0.0Install as a Cake Tool
This Layout implementation formats an NLog event into a JSON representation that adheres to the Elastic Common Schema specification.
The .NET assemblies are published to NuGet under the package name Elastic.CommonSchema.NLog
var config = new LoggingConfiguration();
var consoleTarget = new ConsoleTarget("console") { Layout = new EcsLayout() }; // Use the ECS layout.
config.AddRule(LogLevel.Debug, LogLevel.Fatal, consoleTarget);
LogManager.Configuration = config;
var logger = LogManager.GetCurrentClassLogger();
The sample above uses EcsLayout with the NLog console target, but you are free to use any target of your choice, perhaps consider
the NLog FileTarget and Elastic Filebeat for durable and reliable ingestion.
<nlog>
<extensions>
<add assembly="Elastic.CommonSchema.NLog"/>
</extensions>
<targets>
<target name="console" xsi:type="console">
<layout xsi:type="EcsLayout">
<metadata name="MyProperty" layout="MyPropertyValue" />
<label name="MyLabel" layout="MyLabelValue" />
<tag layout="MyTagValue" />
</layout>
</target>
</targets>
<rules>
<logger name="*" minLevel="Debug" writeTo="Console" />
</rules>
</nlog>
Metadata Options
truefalseEvent Options
Agent Options
Process Options
${processname:FullName=true}${processid}${processname:FullName=false}${processinfo:MainWindowTitle}${threadid}Server Options
${environment-user}Host Options
${machinename}Log Origin Options
${exception:format=method}${exception:format=source}Http Options
${aspnet-trace-identifier}${aspnet-request-method}${aspnet-request-contentlength}${aspnet-request-referrer}${aspnet-response-statuscode}Url Options
${aspnet-request-url:IncludeScheme=true:IncludeHost=false:IncludePath=false}${aspnet-request-url:IncludeScheme=false:IncludeHost=true:IncludePath=false}${aspnet-request-url:IncludeScheme=false:IncludeHost=false:IncludePath=true}${aspnet-request-url:IncludeScheme=false:IncludeHost=false:IncludePath=false:IncludePort=true}${aspnet-request-url:IncludeScheme=false:IncludeHost=false:IncludePath=false:IncludeQueryString=true}${aspnet-user-identity}Trace Options
System.Diagnostics.Activity.Current.TraceIdSystem.Diagnostics.Activity.Current.SpanIdTransaction Options
${ElasticApmTransactionId}Additionally any valid ECS log template properties that is available under LogTemplateProperties.* e.g LogTemplateProperties.TraceId
is supported and will directly set the appropriate ECS fields.
logger.Info("The time is {TraceId}", "my-trace-id");
Will override trace.id on the resulting ECS json document.
An example of the output is given below:
{
"@timestamp": "2020-02-20T16:07:06.7109766+11:00",
"log.level": "Info",
"message": "Info \"X\" 2.2",
"ecs.version": "9.0.0",
"log": {
"logger": "Elastic.CommonSchema.NLog.Tests.LogTestsBase"
},
"labels": {
"ValueX": "X"
},
"agent": {
"type": "Elastic.CommonSchema.NLog",
"version": "1.6.0"
},
"event": {
"created": "2020-02-20T16:07:06.7109766+11:00",
"severity": 6,
"timezone": "Romance Standard Time"
},
"host": {
"ip": [ "127.0.0.1" ],
"name": "LOCALHOST"
},
"process": {
"executable": "C:\\Program Files\\dotnet\\dotnet.exe",
"name": "dotnet",
"pid": 17592,
"thread.id": 17592,
"title": "15.0.0.0"
},
"server": { "user": { "name": "MyUser" } },
"service": {
"name": "Elastic.CommonSchema",
"type": "dotnet",
"version": "1.6.0"
},
"metadata": {
"SomeY": 2.2
},
"MessageTemplate": "Info {ValueX} {SomeY} {NotX}"
}
This software is Copyright (c) 2014-2020 by Elasticsearch BV.
This is free software, licensed under: The Apache License Version 2.0.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 is compatible. |
| .NET Framework | net461 net461 was computed. net462 net462 is compatible. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 2 NuGet packages that depend on Elastic.CommonSchema.NLog:
| Package | Downloads |
|---|---|
|
Elastic.NLog.Targets
NLog Target that exports directly to Elastic Cloud or individual Elasticsearch nodes |
|
|
Proxmea.ILoggerN
Proxmea.ILoggerN provides a shared, configurable logging setup for .NET 8 applications using NLog, with a focus on minimal code and settings to get up running. It enables consistent, centralized logging across your application, supporting both console, file and Elastic outputs by default. It also adds missing functionality to be able to log individual properties. The package is designed for easy integration with ASP.NET Core projects and leverages dependency injection for logger access. It's utilizing NLog as the logging provider, mainly because of its high performance. |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 9.0.0 | 219,703 | 8/13/2025 |
| 8.19.0 | 27,423 | 8/13/2025 |
| 8.18.2 | 143,333 | 6/27/2025 |
| 8.18.1 | 81,214 | 5/28/2025 |
| 8.18.0 | 26,908 | 5/22/2025 |
| 8.12.3 | 531,827 | 11/26/2024 |
| 8.12.2 | 193,055 | 10/22/2024 |
| 8.12.1 | 40,443 | 10/3/2024 |
| 8.12.0 | 19,175 | 9/26/2024 |
| 8.11.1 | 373,633 | 6/10/2024 |
| 8.11.0 | 98,555 | 4/10/2024 |
| 8.6.1 | 329,048 | 8/3/2023 |
| 8.6.0 | 61,395 | 5/9/2023 |
| 8.4.0-alpha4 | 2,279 | 3/28/2023 |
| 8.4.0-alpha3 | 822 | 3/15/2023 |
| 8.4.0-alpha2 | 832 | 3/1/2023 |
| 8.4.0-alpha1 | 829 | 2/20/2023 |
| 1.6.0-alpha1 | 158,228 | 6/2/2021 |
| 1.5.3 | 767,578 | 6/1/2021 |
| 1.5.1 | 29,822 | 6/3/2020 |