This projects aims to make Graylog a comfortable logging sink for Serilog The project and optional dependencies are all .NetStandard 2.0 libraries, so cross platform usage over .Net platforms is ensured.
- UDP (with optional GZIP compression using SharpCompress)
- TCP without encryption and optional Null-Byte delimiter
- TCP with TLS and optional Null-Byte delimiter
- HTTP withou encryption
All transports can be used synchoniously and asynchroniouly.
In order to create a new sink one has to create an instance of class GraylogSinkConfiguration
first. then you could use the fluent syntax and just call Graylog()
extension method with the prepared config instance.
The following snippet will create a new sink:
var graylogConfig = new GraylogSinkConfiguration
{
TransportType = TransportType.TCP,
Host = "example.graylog.local",
Port = 12201,
UseSecureConnection = true,
UseAsyncLogging = true
};
using(var log = new LoggerConfiguration()
.WriteTo.Graylog(graylogConfig)
.CreateLogger())
{
log.Information("testing TLS secured {connectionType}", graylogConfig.TransportType);
}
Further examples can be found in the testing projects.
This project is licensed under Apache 2.0 license.