Serilog.Sinks.AzureAnalytics
4.5.0
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
<PackageReference Include="Serilog.Sinks.AzureAnalytics" Version="4.5.0" />
paket add Serilog.Sinks.AzureAnalytics --version 4.5.0
#r "nuget: Serilog.Sinks.AzureAnalytics, 4.5.0"
// 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 | 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. |
.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. |
-
.NETCoreApp 2.2
- Newtonsoft.Json (>= 12.0.1)
- Serilog (>= 2.8.0)
- System.Net.Http (>= 4.3.4)
-
.NETFramework 4.5.2
- Newtonsoft.Json (>= 12.0.1)
- Serilog (>= 2.8.0)
- System.Net.Http (>= 4.3.4)
-
.NETFramework 4.7.2
- Newtonsoft.Json (>= 12.0.1)
- Serilog (>= 2.8.0)
- System.Net.Http (>= 4.3.4)
-
.NETStandard 1.3
- Microsoft.CSharp (>= 4.5.0)
- NETStandard.Library (>= 1.6.1)
- Newtonsoft.Json (>= 12.0.1)
- Serilog (>= 2.8.0)
- System.Net.Http (>= 4.3.4)
- System.Security.Cryptography.Algorithms (>= 4.3.1)
-
.NETStandard 2.0
- Microsoft.CSharp (>= 4.5.0)
- Newtonsoft.Json (>= 12.0.1)
- Serilog (>= 2.8.0)
- System.Net.Http (>= 4.3.4)
- System.Security.Cryptography.Algorithms (>= 4.3.1)
NuGet packages (10)
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 |
|
AICentral.Logging.AzureMonitor
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. |
|
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 | 816,495 | 6/16/2023 | |
4.8.0 | 1,163,283 | 6/30/2022 | |
4.7.0 | 1,324,381 | 1/10/2021 | |
4.6.0 | 1,072,321 | 8/14/2019 | |
4.6.0-dev-00156 | 568 | 7/5/2019 | |
4.6.0-dev-00154 | 548 | 6/21/2019 | |
4.5.0 | 175,851 | 4/11/2019 | |
4.5.0-dev-00146 | 617 | 3/19/2019 | |
4.0.0 | 85,779 | 1/2/2019 | |
3.1.0 | 360,708 | 6/11/2018 | |
2.3.0 | 87,277 | 4/10/2018 | |
2.2.5 | 20,871 | 2/23/2018 | |
2.2.0 | 7,522 | 1/15/2018 | |
2.2.0-dev-00106 | 1,028 | 2/21/2018 | |
2.1.1 | 1,455 | 1/10/2018 | |
2.0.0 | 12,788 | 9/10/2017 | |
1.8.8 | 5,591 | 5/29/2017 | |
1.8.3 | 3,509 | 4/12/2017 | |
1.8.1 | 18,898 | 4/5/2017 | |
1.7.45 | 10,611 | 11/26/2016 | |
1.2.5 | 1,305 | 10/22/2016 | |
1.2.0 | 1,329 | 10/13/2016 | |
1.1.5 | 3,721 | 10/13/2016 |