Skip to content
This repository has been archived by the owner on Jun 1, 2024. It is now read-only.

Configure the sink

Michiel van Oudheusden edited this page Apr 5, 2015 · 10 revisions

You need to pass in a configuration instance when registering the sink. In the constructor you need to pass in at least a uri where the Elasticsearch server is running. This is in the form of http://localhost:9200 for example.

You can also pass in multiple addresses and the internal Elasticsearch.net library will use all the addresses and connect to the first one responding. When this instance fails to respond it will automatically switch to the other ones listed. Use this to provide higher availability for your Elasticsearch endpoints.

Options

You can set the following options in the ElasticsearchSinkOptions instance that you pass to the sink.

Property Default value Description
AutoRegisterTemplate False When set to true the sink will register an index template for the logs in Elasticsearch. This template is optimized to deal with serilog events
TemplateName serilog-events-template When using the AutoRegisterTemplate feature this allows you to override the default template name
ModifyConnectionSetttings Pass in a custom function for the connection configuration to use for connecting to the cluster.
IndexFormat logstash-{0:yyyy.MM.dd} The index name formatter. A string.Format using the DateTimeOffset of the event is run over this string.
TypeName logevent The default elasticsearch type name to use for the log events.
BatchPostingLimit 50 The maximum number of events to post in a single batch.
Period 2 seconds The time to wait between checking for event batches.
FormatProvider null Supplies culture-specific formatting information
Connection Allows you to override the connection used to communicate with elasticsearch
ConnectionTimeout 5000 The connection timeout (in milliseconds) when sending bulk operations to elasticsearch
InlineFields False When true fields will be written at the root of the json document
MinimumLogEventLevel Information The minimum log event level required in order to write an event to the sink.
Serializer When passing a serializer unknown object will be serialized to object instead of relying on their ToString representation
ConnectionPool The connectionpool describing the cluster to write event to
IndexDecider Function to decide which index to write the LogEvent to
BufferBaseFilename Optional path to directory that can be used as a log shipping buffer for increasing the reliability of the log forwarding.
BufferFileSizeLimitBytes The maximum size, in bytes, to which the buffer log file for a specific date will be allowed to grow. By default no limit will be applied.
BufferLogShippingInterval The interval between checking the buffer files
CustomFormatter Customizes the formatter used when converting log events into ElasticSearch documents. Please note that the formatter output must be valid JSON
CustomDurableFormatter Customizes the formatter used when converting log events into the durable sink. Please note that the formatter output must be valid JSON
Clone this wiki locally