A Serilog sink that writes events in periodic batches to Humio.
Package - Serilog.Sinks.Humio
Platforms - .NET Standard 2.0
The sink takes care of formatting Serilog's structured logs and sending them to Humio using the structured approach in Humio's Ingest API.
Simple
var log = new LoggerConfiguration() .WriteTo.HumioSink("{token}") // ingest token is acquired from Humio cloud .CreateLogger();
Advanced configuration
var log = new LoggerConfiguration() .WriteTo.HumioSink(new HumioSinkConfiguration { IngestToken = "{token}", BatchSizeLimit = 50, Period = TimeSpan.FromSeconds(5), // Can be used for an on-premises hosted solution. // If you are using Humio Community edition the url must be set to https://cloud.community.humio.com Url = "https://myOnPremHumio.com", Tags = new KeyValuePair<string, string>[]{ new KeyValuePair<string, string>("host", "{my_host}"), new KeyValuePair<string, string>("source", "{my_application}"), new KeyValuePair<string, string>("tag3", "some value"), new KeyValuePair<string, string>("tag4", "some value"), // ... } RestrictedToMinimumLevel = Serilog.Events.LogEventLevel.Warning }) .CreateLogger();
Using Serilog.Settings.Configuration
var log = new LoggerConfiguration() .ReadFrom.Configuration(configuration) .CreateLogger();
Appsettings.json
{ "Serilog": { "Using": ["Serilog.Sinks.Humio"], "MinimumLevel": { "Default": "Verbose", "Override": { "Microsoft": "Verbose", "Microsoft.Hosting.Lifetime": "Verbose" } }, "WriteTo": [ { "Name": "HumioSink", "Args": { "IngestToken": "{token}", "Url": "https://cloud.community.humio.com" } } ] } }Newtonsoft.Json has been replaced in 2.0.0
The sink now uses System.Text.Json instead of Newtonsoft.Json for serializing the log events. This is to reduce the number of third-party dependencies and to improve performance. The last version of the sink that uses Newtonsoft.Json is 1.1.4. There are no plans to support Newtonsoft.Json in the future.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4