Serilog.Sinks.AzureAnalytics 4.5.0

.NET Core 2.2 .NET Standard 1.3 .NET Framework 4.5.2
There is a newer version of this package available.
See the version list below for details.
dotnet add package Serilog.Sinks.AzureAnalytics --version 4.5.0
NuGet\Install-Package Serilog.Sinks.AzureAnalytics -Version 4.5.0
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="Serilog.Sinks.AzureAnalytics" Version="4.5.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Serilog.Sinks.AzureAnalytics --version 4.5.0
#r "nuget: Serilog.Sinks.AzureAnalytics, 4.5.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Serilog.Sinks.AzureAnalytics as a Cake Addin
#addin nuget:?package=Serilog.Sinks.AzureAnalytics&version=4.5.0

// Install Serilog.Sinks.AzureAnalytics as a Cake Tool
#tool nuget:?package=Serilog.Sinks.AzureAnalytics&version=4.5.0


High performance Serilog sink that writes to Azure Log Analytics. It supports automatic batching of log messages for better performance and auto-recovery from transient errors.

Getting started

Install Serilog.Sinks.AzureAnalytics from NuGet

Install-Package Serilog.Sinks.AzureAnalytics

Configure logger by calling WriteTo.AzureLogAnalytics(<workspaceId>, <authenticationId>)

workspaceId: Workspace Id from Azure OMS Portal connected sources.

authenticationId: Primary or Secondary key from Azure OMS Portal connected sources.

This sink accepts following optional configuration parameters for fine grained control.

logName: A distinguishable log type name. Default is "DiagnosticsLog"

restrictedToMinimumLevel: The minimum log event level required in order to write an event to the sink.

storeTimestampInUtc: Flag dictating if timestamp to be stored in UTC or local timezone format.

formatProvider: Supplies an object that provides formatting information for formatting and parsing operations.

logBufferSize: Maximum number of log entries this sink can hold before stop accepting log messages. Default is 25000, acceptable range is between 5000 to 100000.

batchSize: Number of log messages to be sent as batch. Default 100, acceptable range is between 1 and 1000

azureOfferingType: Enum specifying if log is being sent to public or government subscription. Default is AzureOfferingType.Public

flattenObject: Flag to set if complex object in LogProperties should be flatten out or embed as JSON object. Default is True.

var logger = new LoggerConfiguration()
    .WriteTo.AzureLogAnalytics(<workspaceId>, <authenticationId>)

XML <appSettings> configuration

To use the AzureLogAnalytics sink with the Serilog.Settings.AppSettings package, first install that package if you haven't already done so:

Install-Package Serilog.Settings.AppSettings

In your code, call ReadFrom.AppSettings()

var logger = new LoggerConfiguration()

In your application's App.config or Web.config file, specify the AzureLogAnalytics sink assembly and required workspaceId and authenticationId parameters under the <appSettings>

  <add key="serilog:using:AzureLogAnalytics" value="Serilog.Sinks.AzureAnalytics" />
  <add key="serilog:write-to:AzureLogAnalytics.workspaceId" value="*************" />
  <add key="serilog:write-to:AzureLogAnalytics.authenticationId" value="*************" />


Sink buffers log internally and flush to Azure Log Analytics in batches using dedicated thread for better performance.

Azure Log Analytics data limits

There are some constraints around the data posted to the Log Analytics Data collection API.

Maximum of 30 MB per post to Log Analytics. This is a size limit for a single post. If the data from a single post that exceeds 30 MB, you should split the data up to smaller sized chunks and send them concurrently.

Maximum of 32 KB limit for field values. If the field value is greater than 32 KB, the data will be truncated.

Recommended maximum number of fields for a given type is 50. This is a practical limit from a usability and search experience perspective.

Note: Log data exceeding maximum permissible size will get dropped and will not appear in Azure Log.

Many thanks to the <img src="resources/jetbrains.svg" width="100px"/> for donating awesome suite of tools making this project possible.

Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows
.NET Core netcoreapp1.0 netcoreapp1.1 netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard1.3 netstandard1.4 netstandard1.5 netstandard1.6 netstandard2.0 netstandard2.1
.NET Framework net452 net46 net461 net462 net463 net47 net471 net472 net48
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen30 tizen40 tizen60
Universal Windows Platform uap uap10.0
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (5)

Showing the top 5 NuGet packages that depend on Serilog.Sinks.AzureAnalytics:

Package Downloads

The Collection of the Logging related functionality for AspNetCore or GenericHost.


Package Description


Package Description


Official SPA Cbcrc Logging Package. Supports Dependency Injection and the IOptions Pattern. Supports a local File Sink as well Azure Log Analytics.


Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
4.8.0 159,765 6/30/2022
4.7.0 862,911 1/10/2021
4.6.0 792,241 8/14/2019
4.6.0-dev-00156 470 7/5/2019
4.6.0-dev-00154 447 6/21/2019
4.5.0 147,790 4/11/2019
4.5.0-dev-00146 516 3/19/2019
4.0.0 72,603 1/2/2019
3.1.0 216,951 6/11/2018
2.3.0 78,422 4/10/2018
2.2.5 18,266 2/23/2018
2.2.0 7,066 1/15/2018
2.2.0-dev-00106 894 2/21/2018
2.1.1 1,259 1/10/2018
2.0.0 12,474 9/10/2017
1.8.8 5,377 5/29/2017
1.8.3 3,328 4/12/2017
1.8.1 16,017 4/5/2017
1.7.45 10,030 11/26/2016
1.2.5 1,097 10/22/2016
1.2.0 1,150 10/13/2016
1.1.5 2,111 10/13/2016