NLog.Extensions.AzureEventHub
4.7.0
dotnet add package NLog.Extensions.AzureEventHub --version 4.7.0
NuGet\Install-Package NLog.Extensions.AzureEventHub -Version 4.7.0
<PackageReference Include="NLog.Extensions.AzureEventHub" Version="4.7.0" />
<PackageVersion Include="NLog.Extensions.AzureEventHub" Version="4.7.0" />
<PackageReference Include="NLog.Extensions.AzureEventHub" />
paket add NLog.Extensions.AzureEventHub --version 4.7.0
#r "nuget: NLog.Extensions.AzureEventHub, 4.7.0"
#:package NLog.Extensions.AzureEventHub@4.7.0
#addin nuget:?package=NLog.Extensions.AzureEventHub&version=4.7.0
#tool nuget:?package=NLog.Extensions.AzureEventHub&version=4.7.0
Azure EventHubs
| Package Name | NuGet | Description |
|---|---|---|
| NLog.Extensions.AzureEventHub | Azure EventHubs |
EventHub Configuration
Syntax
<extensions>
<add assembly="NLog.Extensions.AzureEventHub" />
</extensions>
<targets>
<target xsi:type="AzureEventHub"
name="String"
layout="Layout"
connectionString="Layout"
eventHubName="Layout"
partitionKey="Layout"
contentType="Layout"
messageId="Layout"
correlationId="Layout">
<messageProperty name="level" layout="${level}" />
<messageProperty name="exception" layout="${exception:format=shorttype}" includeEmptyValue="false" />
<layout type="JsonLayout" includeAllProperties="true">
<attribute name="time" layout="${longdate}" />
<attribute name="message" layout="${message}" />
<attribute name="threadid" layout="${threadid}" />
<attribute name="exception" layout="${exception:format=tostring}" />
</layout>
</target>
</targets>
General Options
name - Name of the target.
connectionString - Azure storage connection string. Layout Required.
eventHubName - Overrides the EntityPath in the ConnectionString. Layout
partitionKey - Partition-Key which EventHub uses to generate PartitionId-hash. Layout (Default='0')
layout - EventData Body Text to be rendered and encoded as UTF8. Layout.
contentType - EventData ContentType. Layout. Ex. application/json
messageId - EventData MessageId. Layout
correlationId - EventData Correlationid. Layout
useWebSockets - Enable AmqpWebSockets. Ex. true/false (optional)
customEndpointAddress - Custom endpoint address that can be used when establishing the connection (optional)
serviceUri - Alternative to ConnectionString, where Managed Identiy is applied from DefaultAzureCredential.
eventProducerIdentifier - A unique name used to identify the event producer. If null or empty, a GUID will be used as the identifier (optional)
Authentication Options
managedIdentityClientId - Sets ManagedIdentityClientId on DefaultAzureCredentialOptions. Requires serviceUri
managedIdentityResourceId - resourceId for ManagedIdentityResourceId on DefaultAzureCredentialOptions, do not use together with ManagedIdentityClientId. Requires serviceUri.
tenantIdentity - tenantId for DefaultAzureCredentialOptions. Requires serviceUri.
sharedAccessSignature - Access signature for AzureSasCredential authentication. Requires serviceUri.
accountName - accountName for AzureNamedKeyCredential authentication. Requires serviceUri and accessKey.
accessKey - accountKey for AzureNamedKeyCredential authentication. Requires serviceUri and accountName.
clientAuthId - clientId for ClientSecretCredential authentication. Requires serviceUri, tenantIdentity and clientAuthSecret.
clientAuthSecret - clientSecret for ClientSecretCredential authentication. Requires serviceUri,tenantIdentity and clientAuthId.
Proxy Options
noProxy - Bypasses any system proxy and proxy in ProxyAddress when set to true. Requires useWebSockets = true.
proxyAddress - Address of the proxy server to use (e.g. http://proxyserver:8080). Requires useWebSockets = true.
proxyLogin - Login to use for the proxy server. Requires proxyPassword. Requires useWebSockets = true.
proxyPassword - Password to use for the proxy server. Requires proxyLogin. Requires useWebSockets = true.
useDefaultCredentialsForProxy - Uses the default credentials (System.Net.CredentialCache.DefaultCredentials) for the proxy server. Take precedence over proxyLogin and proxyPassword when set to true. Requires useWebSockets = true.
Batching Policy
maxBatchSizeBytes - Max size of a single batch in bytes Integer (Default=1024*1024)
batchSize - Number of EventData items to send in a single batch (Default=100)
taskDelayMilliseconds - Artificial delay before sending to optimize for batching (Default=200 ms)
queueLimit - Number of pending LogEvents to have in memory queue, that are waiting to be sent (Default=10000)
overflowAction - Action to take when reaching limit of in memory queue (Default=Discard)
Retry Policy
taskTimeoutSeconds - How many seconds a Task is allowed to run before it is cancelled (Default 150 secs)
retryDelayMilliseconds - How many milliseconds to wait before next retry (Default 500ms, and will be doubled on each retry).
retryCount - How many attempts to retry the same Task, before it is aborted (Default 0)
Azure Identity Environment
When using ServiceUri (Instead of ConnectionString), then DefaultAzureCredential is used for Azure Identity which supports environment variables:
AZURE_CLIENT_ID- For ManagedIdentityClientId / WorkloadIdentityClientIdAZURE_TENANT_ID- For TenantId
See also: Set up Your Environment for Authentication
Azure ConnectionString
NLog Layout makes it possible to retrieve settings from many locations.
Lookup ConnectionString from appsettings.json
connectionString="${configsetting:ConnectionStrings.AzureEventHub}"
- Example appsettings.json on .NetCore:
{
"ConnectionStrings": {
"AzureEventHub": "UseDevelopmentStorage=true;"
}
}
Lookup ConnectionString from app.config
connectionString="${appsetting:ConnectionStrings.AzureEventHub}"
- Example app.config on .NetFramework:
<configuration>
<connectionStrings>
<add name="AzureEventHub" connectionString="UseDevelopmentStorage=true;"/>
</connectionStrings>
</configuration>
Lookup ConnectionString from environment-variable
connectionString="${environment:AZURE_STORAGE_CONNECTION_STRING}"
Lookup ConnectionString from NLog GlobalDiagnosticsContext (GDC)
connectionString="${gdc:AzureEventHubConnectionString}"
- Example code for setting GDC-value:
NLog.GlobalDiagnosticsContext.Set("AzureEventHubConnectionString", "UseDevelopmentStorage=true;");
| 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 is compatible. 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. |
-
.NETStandard 2.0
- Azure.Identity (>= 1.16.0)
- Azure.Messaging.EventHubs (>= 5.12.2)
- NLog (>= 5.2.5)
-
net8.0
- Azure.Identity (>= 1.16.0)
- Azure.Messaging.EventHubs (>= 5.12.2)
- NLog (>= 5.2.5)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.7.0 | 333 | 11/13/2025 |
| 4.6.0 | 7,775 | 7/13/2025 |
| 4.5.0 | 1,591 | 6/30/2025 |
| 4.4.2 | 8,681 | 3/5/2025 |
| 4.4.1 | 171,094 | 6/24/2024 |
| 4.4.0 | 15,509 | 1/29/2024 |
| 4.3.1 | 14,271 | 10/24/2023 |
| 4.3.0 | 30,750 | 9/15/2023 |
| 4.2.0 | 35,136 | 5/23/2023 |
| 4.1.0 | 7,309 | 2/9/2023 |
| 4.0.0 | 13,151 | 11/10/2022 |
| 3.3.0 | 36,090 | 10/5/2022 |
| 3.2.0 | 106,331 | 3/28/2022 |
| 3.1.0 | 14,536 | 10/5/2021 |
| 3.0.0 | 24,327 | 7/20/2021 |
| 2.7.0 | 8,616 | 5/24/2021 |
| 2.6.1 | 73,717 | 3/25/2021 |
| 2.6.0 | 327,352 | 11/13/2020 |
| 2.5.0 | 9,031 | 8/14/2020 |
| 2.4.0 | 5,823 | 4/21/2020 |
| 2.3.0 | 1,820 | 4/6/2020 |
| 2.1.0 | 13,115 | 10/2/2019 |
| 2.0.0-preview | 604 | 9/8/2019 |
| 0.9.0 | 926 | 8/29/2019 |
- Added support for Proxy-options: ProxyAddress, ProxyLogin, ProxyPassword, NoProxy, UseDefaultCredentialsForProxy
- Added support for Authentication-options: ClientAuthId + ClientAuthSecret
- Added support for EventProducerIdentifier-option
- Updated Azure.Identity to ver 1.16.0 (Bug fixes)
- Enabled XML documentation file generation
- Added README.md to nuget-package
Docs: https://github.com/JDetmar/NLog.Extensions.AzureStorage/blob/master/src/NLog.Extensions.AzureEventHub/README.md