Writes Serilog events to a Kafka.
Log.Logger = new LoggerConfiguration()
.WriteTo.Kafka(batchSizeLimit: 50, period: 1, brokers: brokers, topic: topic)
.CreateLogger();
A Serilog settings provider that reads from Microsoft.Extensions.Configuration, .NET Core's appsettings.json
file.
Configuration is read from the Serilog
section.
{
"Serilog": {
"Using": [ "Serilog.Sinks.Kafka" ],
"MinimumLevel": {
"Override": {
"Microsoft": "Warning",
"System": "Warning"
}
},
"WriteTo": [
{
"Name": "Kafka",
"Args": { "batchSizeLimit" : "50", "period" : "5", "brokers" : "10.2.1.174:32768", "topic": "demo" }
}
],
"Properties": {
"Application": "Kafka"
}
}
}
You can see how to configure Serilog.Sinks.Kafka using WriteTo or ReadFrom and test it with a SimpleConsumer:
_Copyright © 2016 Lurumad Contributors