Giter Site home page Giter Site logo

logicsoftware / serilog-sinks-azure-analytics Goto Github PK

View Code? Open in Web Editor NEW

This project forked from saleem-mirza/serilog-sinks-azure-analytics

0.0 18.0 0.0 74 KB

Serilog sink which writes to Azure analytics

License: Apache License 2.0

PowerShell 2.17% C# 97.83%

serilog-sinks-azure-analytics's Introduction

Serilog.Sinks.AzureAnalytics

High performance Serilog sink that writes to Azure Log Analytics. Sink do support 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

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

XML 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.


Many thanks to the for donating awesome suite of tools making this project possible.

serilog-sinks-azure-analytics's People

Contributors

saleem-mirza avatar cognosticator avatar maldworth avatar

Watchers

Siarhei Huliakevich avatar James Cloos avatar  avatar Denis Borovnev avatar  avatar Pavel Pachobut avatar  avatar ilya vasilyeu avatar Paul Harbuzoŭ avatar Alexey avatar  avatar Vera Pochobut avatar Andrei Kushal avatar  avatar  avatar Mikalai Kazakevich avatar  avatar Sviataslau Salamennik avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.