Skip to content

TinyBlueRobots/Serilog.Sinks.Syslog

Repository files navigation

Serilog.Sinks.Syslog

NuGet Version

Writes Serilog events to Syslog.

Getting started

Install the Serilog.Sinks.SyslogServer package from NuGet:

Install-Package Serilog.Sinks.SyslogServer

To configure the sink in C# code, call WriteTo.Syslog() during logger configuration:

var log = new LoggerConfiguration()
    .WriteTo.Syslog("syslog.domain.com", 12345, "my-app")
    .CreateLogger();

server The address of the syslog server.

port The port number of the syslog server.

application The name of the application.

Optional parameters

facility The syslog facility. Defaults to User.

batchSizeLimit The maximum number of events to include in a single batch.

period The time to wait between checking for event batches.

queueLimit Maximum number of events in the queue.

outputTemplate A message template describing the output messages. See https://github.com/serilog/serilog/wiki/Formatting-Output.

restrictedToMinimumLevel The minimum level for events passed through the sink.

This sink endeavours to support RFC5424:

Optionally, MSGID is set to the SourceContext

Optionally, PROCID is set using Serilog.Enrichers.Process and Enrich.WithProcessId()

STRUCTURED-DATA is set using the SD-ID structuredData@0 and contains all the event's properties