NLog.Extensions.AzureBlobStorage
4.8.0
dotnet add package NLog.Extensions.AzureBlobStorage --version 4.8.0
NuGet\Install-Package NLog.Extensions.AzureBlobStorage -Version 4.8.0
<PackageReference Include="NLog.Extensions.AzureBlobStorage" Version="4.8.0" />
<PackageVersion Include="NLog.Extensions.AzureBlobStorage" Version="4.8.0" />
<PackageReference Include="NLog.Extensions.AzureBlobStorage" />
paket add NLog.Extensions.AzureBlobStorage --version 4.8.0
#r "nuget: NLog.Extensions.AzureBlobStorage, 4.8.0"
#:package NLog.Extensions.AzureBlobStorage@4.8.0
#addin nuget:?package=NLog.Extensions.AzureBlobStorage&version=4.8.0
#tool nuget:?package=NLog.Extensions.AzureBlobStorage&version=4.8.0
Azure BlobStorage
| Package Name | NuGet | Description |
|---|---|---|
| NLog.Extensions.AzureBlobStorage | Azure Blob Storage |
Blob Configuration
Syntax
<extensions>
<add assembly="NLog.Extensions.AzureBlobStorage" />
</extensions>
<targets>
<target xsi:type="AzureBlobStorage"
name="String"
layout="Layout"
connectionString="Layout"
blobName="Layout"
container="Layout">
<metadata name="mymeta" layout="mymetavalue" />
<tag name="mytag" layout="mytagvalue" />
</target>
</targets>
General Options
name - Name of the target.
layout - Text to be rendered. Layout Required.
blobName - BlobName. Layout Required.
container - Azure blob container name. Layout Required.
contentType - Azure blob ContentType (Default = text/plain)
metadata / tag - Metadata and blob index tags set on a blob when the target creates it (Optional).
The layouts are rendered from the first log event written to a new blob, and existing blobs are not updated.
Characters Azure does not accept are replaced with _: tag values allow only a-z A-Z 0-9, space and + - . / : = _ (max 256 chars), and metadata values must be printable ASCII (leading/trailing whitespace is trimmed).
If Azure still rejects them (for example an invalid name, more than 10 tags, or a SAS without tag permission), the blob is created without metadata and tags and an error is written to the NLog internal log.
connectionString - Azure Blob Storage connection string from your storage account. Required unless using ServiceUri.
serviceUri - Uri to reference the blob service (e.g. https://{account_name}.blob.core.windows.net). Alternative to ConnectionString, where Managed Identiy is applied from DefaultAzureCredential.
Authentication Options
managedIdentityClientId - clientId for ManagedIdentityClientId on DefaultAzureCredentialOptions. Requires serviceUri.
managedIdentityResourceId - resourceId for ManagedIdentityResourceId on DefaultAzureCredentialOptions, do not use together with ManagedIdentityClientId. Requires serviceUri.
tenantIdentity - tenantId for DefaultAzureCredentialOptions and ClientSecretCredential. Requires serviceUri.
sharedAccessSignature - Access signature for AzureSasCredential authentication. Requires serviceUri.
accountName - accountName for StorageSharedKeyCredential authentication. Requires serviceUri and accessKey.
accessKey - accountKey for StorageSharedKeyCredential authentication. Requires serviceUri and accountName.
clientAuthId - clientId for ClientSecretCredential OAuth2 authentication. Requires serviceUri, tenantIdentity and clientAuthSecret.
clientAuthSecret - clientSecret for ClientSecretCredential OAuth2 authentication. Requires serviceUri,tenantIdentity and clientAuthId.
When using ServiceUri (Instead of ConnectionString) with DefaultAzureCredential, then Azure Identity can also resolve from environment variables:
AZURE_CLIENT_ID- For ManagedIdentityClientId / WorkloadIdentityClientIdAZURE_TENANT_ID- For TenantId
See also: Set up Your Environment for Authentication
Proxy Options
noProxy - Bypasses any system proxy and proxy in ProxyAddress when set to true.
proxyAddress - Address of the proxy server to use (e.g. http://proxyserver:8080).
proxyLogin - Login to use for the proxy server. Requires proxyPassword.
proxyPassword - Password to use for the proxy server. Requires proxyLogin.
useDefaultCredentialsForProxy - Uses the default credentials (System.Net.CredentialCache.DefaultCredentials) for the proxy server. Take precedence over proxyLogin and proxyPassword when set to true.
Batching Policy
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 Blob Storage Emulator
The AzureBlobStorage-target uses Append blob operations, which is not support by Azure Storage Emulator from Microsoft.
It will fail with the following error:
Azure.RequestFailedException: This feature is not currently supported by the Storage Emulator
Instead one can try an alternative Azure Storage Emulator like Azurite
Azure ConnectionString
NLog Layout makes it possible to retrieve settings from many locations.
Lookup ConnectionString from appsettings.json
connectionString="${configsetting:ConnectionStrings.AzureBlob}"
- Example appsettings.json on .NetCore:
{
"ConnectionStrings": {
"AzureBlob": "UseDevelopmentStorage=true;"
}
}
Lookup ConnectionString from app.config
connectionString="${appsetting:ConnectionStrings.AzureBlob}"
- Example app.config on .NetFramework:
<configuration>
<connectionStrings>
<add name="AzureBlob" connectionString="UseDevelopmentStorage=true;"/>
</connectionStrings>
</configuration>
Lookup ConnectionString from environment-variable
connectionString="${environment:AZURE_STORAGE_CONNECTION_STRING}"
Lookup ConnectionString from NLog GlobalDiagnosticsContext (GDC)
connectionString="${gdc:AzureBlobConnectionString}"
- Example code for setting GDC-value:
NLog.GlobalDiagnosticsContext.Set("AzureBlobConnectionString", "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 is compatible. 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.17.1)
- Azure.Storage.Blobs (>= 12.24.1)
- NLog (>= 5.2.5)
-
net10.0
- Azure.Identity (>= 1.17.1)
- Azure.Storage.Blobs (>= 12.24.1)
- NLog (>= 5.2.5)
-
net8.0
- Azure.Identity (>= 1.17.1)
- Azure.Storage.Blobs (>= 12.24.1)
- 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.8.0 | 3,327 | 10/28/2026 |
| 4.7.2 | 74,788 | 6/25/2026 |
| 4.7.1 | 156,370 | 11/23/2025 |
| 4.7.0 | 3,667 | 11/13/2025 |
| 4.6.0 | 95,006 | 7/13/2025 |
| 4.5.0 | 33,206 | 6/30/2025 |
| 4.4.2 | 4,992 | 5/30/2025 |
| 4.4.1 | 94,901 | 3/5/2025 |
| 4.4.0 | 522,302 | 6/24/2024 |
| 4.3.1 | 498,660 | 10/24/2023 |
| 4.3.0 | 55,059 | 9/15/2023 |
| 4.2.0 | 121,217 | 5/23/2023 |
| 4.1.0 | 163,789 | 2/9/2023 |
| 4.0.0 | 92,079 | 11/10/2022 |
| 3.2.0 | 47,431 | 10/5/2022 |
| 3.1.1 | 49,069 | 8/8/2022 |
| 3.1.0 | 144,822 | 3/28/2022 |
| 3.0.0 | 654,628 | 10/25/2020 |
| 2.4.0 | 197,187 | 8/26/2020 |
| 2.3.0 | 113,909 | 4/6/2020 |
- Metadata and tags are now rendered from the first log event written to a new blob, so event-based layouts like ${event-properties} work (#212)
- Changed: a tag that renders empty is now skipped unless includeEmptyValue="true" (previously sent as an empty value) (#212)
- Fixed whole-batch loss when a rendered tag or metadata value breaks Azure's rules: invalid characters are replaced with '_', metadata values are trimmed and tag values truncated to 256 chars (#214, #215)
- Fixed whole-batch loss when Azure rejects metadata or tags (invalid name, more than 10 tags, 8 KB metadata limit, SAS without tag permission): the blob is now created without them and an error is logged (#214)
Docs: https://github.com/JDetmar/NLog.Extensions.AzureStorage/blob/master/src/NLog.Extensions.AzureBlobStorage/README.md