Serilog.Sinks.Humio
Serilog sink for Humio
Install / Use
/learn @ThomasWillumsen/Serilog.Sinks.HumioREADME
Serilog.Sinks.Humio
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.
<br/>Configuration
Simple
var log = new LoggerConfiguration()
.WriteTo.HumioSink("{token}") // ingest token is acquired from Humio cloud
.CreateLogger();
<br/>
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();
<br/>
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.
Related Skills
node-connect
348.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
108.8kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
348.0kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
348.0kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
