Serilog.Sinks.AzureAnalytics 4.5.0

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 and Polyglot Notebooks. 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

Serilog.Sinks.AzureAnalytics

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>)
    .CreateLogger();

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()
    .ReadFrom.AppSettings()
    .CreateLogger();

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

<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="*************" />
 </appSettings>

Performance

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 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. 
.NET Core netcoreapp1.0 was computed.  netcoreapp1.1 was computed.  netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 is compatible.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard1.3 is compatible.  netstandard1.4 was computed.  netstandard1.5 was computed.  netstandard1.6 was computed.  netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net452 is compatible.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 is compatible.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen30 was computed.  tizen40 was computed.  tizen60 was computed. 
Universal Windows Platform uap was computed.  uap10.0 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.

NuGet packages (8)

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

Package Downloads
Bet.Extensions.Logging

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

eFormed.Logging

Package Description

Spa.Cbcrc.Logging

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

AICentral.Logging.AzureMonitor

Package Description

Moedim.Microservices.Logging.Serilog

The collection of libraries for developing Microservices with Microsoft .NET Core.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
5.0.0 444,021 6/16/2023
4.8.0 914,056 6/30/2022
4.7.0 1,222,980 1/10/2021
4.6.0 978,732 8/14/2019
4.6.0-dev-00156 538 7/5/2019
4.6.0-dev-00154 517 6/21/2019
4.5.0 163,721 4/11/2019
4.5.0-dev-00146 585 3/19/2019
4.0.0 81,196 1/2/2019
3.1.0 280,018 6/11/2018
2.3.0 84,597 4/10/2018
2.2.5 20,628 2/23/2018
2.2.0 7,444 1/15/2018
2.2.0-dev-00106 988 2/21/2018
2.1.1 1,407 1/10/2018
2.0.0 12,716 9/10/2017
1.8.8 5,535 5/29/2017
1.8.3 3,464 4/12/2017
1.8.1 17,769 4/5/2017
1.7.45 10,399 11/26/2016
1.2.5 1,243 10/22/2016
1.2.0 1,291 10/13/2016
1.1.5 2,740 10/13/2016