NLog.Targets.OpenTelemetryProtocol
1.0.7
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package NLog.Targets.OpenTelemetryProtocol --version 1.0.7
NuGet\Install-Package NLog.Targets.OpenTelemetryProtocol -Version 1.0.7
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="NLog.Targets.OpenTelemetryProtocol" Version="1.0.7" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NLog.Targets.OpenTelemetryProtocol" Version="1.0.7" />
<PackageReference Include="NLog.Targets.OpenTelemetryProtocol" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add NLog.Targets.OpenTelemetryProtocol --version 1.0.7
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: NLog.Targets.OpenTelemetryProtocol, 1.0.7"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package NLog.Targets.OpenTelemetryProtocol@1.0.7
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=NLog.Targets.OpenTelemetryProtocol&version=1.0.7
#tool nuget:?package=NLog.Targets.OpenTelemetryProtocol&version=1.0.7
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
NLog Target for OpenTelemetry
This target can export logs in the format defined in the OpenTelemetry specification using the OpenTelemetry.Exporter.OpenTelemetryProtocol package.
For an explanation of the log data model, see https://opentelemetry.io/docs/specs/otel/logs/data-model/. <br> For an example, see https://opentelemetry.io/docs/specs/otel/protocol/file-exporter/#examples.
Note that the OpenTelemetry logging API is still unfinished.
Configuration
Example XML config:
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<extensions>
<add assembly="NLog.Targets.OpenTelemetryProtocol"/>
</extensions>
<targets>
<target xsi:type="OtlpTarget"
name="otlp"
usehttp="true"
servicename="TestService"
scheduledDelayMilliseconds="1000"
useDefaultResources="false"
includeFormattedMessage="true">
<attribute name="thread.id" layout="${threadid}" />
<resource name="process.name" layout="${processname}" />
<resource name="process.id" layout="${processid}" />
<resource name="deployment.environment" layout="DEV" />
</target>
</targets>
<rules>
<logger name="*" writeTo="otlp" />
</rules>
</nlog>
Configuration parameters
- UseHttp : Determines whether logs are exported using gRPC or HTTP. Optional, by default false, meaning the gRPC exporter will be used.
- Endpoint : Determines where the exporter should send logs. Used to set OtlpExporterOptions.Endpoint. If left empty, the default values will be used (optional)
- Headers : Used to set OtlpExporterOptions.Headers (optional)
- ServiceName : Used to set the service.name resource (optional)
- Resource : Additional resources to include in the ResourceBuilder (optional)
- Name : Name of Resource.
- Layout : Value of Resource (Will only resolve value at target initialize)
- Attribute : Attributes to be included with each LogEvent (optional)
- Name : Name of Attribute.
- Layout : Value of Attribute (If value is the same for all LogEvents, then add as resource instead)
- MaxQueueSize : The target uses a batch exporter, this defines the max queue size. By default 2048, optional.
- MaxExportBatchSize : The target uses a batch exporter, this defines the max batch size. By default 512, optional.
- ScheduledDelayMilliseconds : The target uses a batch exporter, this defines how often it is flushed in milliseconds. By default 5000, optional.
- UseDefaultResources : By default each exported batch will contain the resources telemetry.sdk.name, telemetry.sdk.language and telemetry.sdk.version. If you don't want them, set to false.
- IncludeFormattedMessage : If you're doing structured logging, this determines whether the body of the outputted log should be the formatted message or the message template. By default false, meaning the body of the outputted log will be the message template. If you aren't doing structured logging, leave this as false.
- IncludeEventProperties : If you're doing structured logging, this determines whether to include NLog LogEvent properties as attributes. By default true, optional.
- IncludeScopeProperties : If you're doing structured logging, this determines whether to include NLog ScopeContext properties as attributes. By default false, optional.
- IncludeEventParameters : Whether to fallback to including NLog LogEvent parameters as attributes, when no NLog LogEvent properties. By default false, optional.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- NLog (>= 5.0.0)
- OpenTelemetry.Exporter.OpenTelemetryProtocol (>= 1.7.0-rc.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on NLog.Targets.OpenTelemetryProtocol:
Repository | Stars |
---|---|
tonyalaribe/todoapi
.NET otel logger example
|
Version | Downloads | Last Updated |
---|---|---|
1.2.2 | 4,322 | 6/26/2025 |
1.2.1 | 4,537 | 6/8/2025 |
1.1.10 | 4,661 | 4/28/2025 |
1.1.9 | 3,843 | 3/21/2025 |
1.1.8 | 1,268 | 3/14/2025 |
1.1.7 | 7,986 | 1/8/2025 |
1.1.6 | 14,940 | 11/19/2024 |
1.1.5 | 973 | 10/17/2024 |
1.1.4 | 20,693 | 6/5/2024 |
1.1.3 | 431 | 5/20/2024 |
1.1.2 | 103 | 5/16/2024 |
1.1.1 | 158 | 3/19/2024 |
1.1.0 | 5,457 | 3/15/2024 |
1.0.8 | 150 | 2/27/2024 |
1.0.7 | 109 | 2/22/2024 |
1.0.6 | 107 | 2/19/2024 |
1.0.5 | 1,524 | 2/8/2024 |
1.0.4 | 119 | 2/7/2024 |
1.0.3 | 97 | 2/5/2024 |
1.0.2 | 152 | 2/1/2024 |
1.0.1 | 525 | 1/29/2024 |
1.0.0 | 356 | 1/29/2024 |