Table of Contents

Class EventCollectorSink

Namespace
Serilog.Sinks.Splunk
Assembly
Serilog.Sinks.Splunk.dll

A sink to log to the Event Collector available in Splunk 6.3

public class EventCollectorSink : IBatchedLogEventSink
Inheritance
EventCollectorSink
Implements
IBatchedLogEventSink
Inherited Members

Constructors

EventCollectorSink(string, string, IFormatProvider, bool, bool, SubSecondPrecision)

Creates a new instance of the sink

public EventCollectorSink(string splunkHost, string eventCollectorToken, IFormatProvider formatProvider = null, bool renderTemplate = true, bool renderMessage = true, SubSecondPrecision subSecondPrecision = SubSecondPrecision.Milliseconds)

Parameters

splunkHost string

The host of the Splunk instance with the Event collector configured

eventCollectorToken string

The token to use when authenticating with the event collector

formatProvider IFormatProvider

The format provider used when rendering the message

renderTemplate bool

Whether to render the message template

renderMessage bool

Include "RenderedMessage" parameter in output JSON message.

subSecondPrecision SubSecondPrecision

Timestamp sub-second precision. Splunk props.conf setup is required.

EventCollectorSink(string, string, string, ITextFormatter, HttpMessageHandler)

Creates a new instance of the sink

public EventCollectorSink(string splunkHost, string eventCollectorToken, string uriPath, ITextFormatter jsonFormatter, HttpMessageHandler messageHandler = null)

Parameters

splunkHost string

The host of the Splunk instance with the Event collector configured

eventCollectorToken string

The token to use when authenticating with the event collector

uriPath string

Change the default endpoint of the Event Collector e.g. services/collector/event

jsonFormatter ITextFormatter

The text formatter used to render log events into a JSON format for consumption by Splunk

messageHandler HttpMessageHandler

The handler used to send HTTP requests

EventCollectorSink(string, string, string, string, string, string, string, CustomFields, IFormatProvider, bool, bool, HttpMessageHandler, SubSecondPrecision)

Creates a new instance of the sink with Customfields

public EventCollectorSink(string splunkHost, string eventCollectorToken, string uriPath, string source, string sourceType, string host, string index, CustomFields fields, IFormatProvider formatProvider = null, bool renderTemplate = true, bool renderMessage = true, HttpMessageHandler messageHandler = null, SubSecondPrecision subSecondPrecision = SubSecondPrecision.Milliseconds)

Parameters

splunkHost string

The host of the Splunk instance with the Event collector configured

eventCollectorToken string

The token to use when authenticating with the event collector

uriPath string

Change the default endpoint of the Event Collector e.g. services/collector/event

source string

The source of the event

sourceType string

The source type of the event

host string

The host of the event

index string

The Splunk index to log to

fields CustomFields

Add extra CustomExtraFields for Splunk to index

formatProvider IFormatProvider

The format provider used when rendering the message

renderTemplate bool

Whether to render the message template

renderMessage bool

Include "RenderedMessage" parameter in output JSON message.

messageHandler HttpMessageHandler

The handler used to send HTTP requests

subSecondPrecision SubSecondPrecision

Timestamp sub-second precision. Splunk props.conf setup is required.

EventCollectorSink(string, string, string, string, string, string, string, IFormatProvider, bool, bool, HttpMessageHandler, SubSecondPrecision)

Creates a new instance of the sink

public EventCollectorSink(string splunkHost, string eventCollectorToken, string uriPath, string source, string sourceType, string host, string index, IFormatProvider formatProvider = null, bool renderTemplate = true, bool renderMessage = true, HttpMessageHandler messageHandler = null, SubSecondPrecision subSecondPrecision = SubSecondPrecision.Milliseconds)

Parameters

splunkHost string

The host of the Splunk instance with the Event collector configured

eventCollectorToken string

The token to use when authenticating with the event collector

uriPath string

Change the default endpoint of the Event Collector e.g. services/collector/event

source string

The source of the event

sourceType string

The source type of the event

host string

The host of the event

index string

The Splunk index to log to

formatProvider IFormatProvider

The format provider used when rendering the message

renderTemplate bool

Whether to render the message template

renderMessage bool

Include "RenderedMessage" parameter in output JSON message.

messageHandler HttpMessageHandler

The handler used to send HTTP requests

subSecondPrecision SubSecondPrecision

Timestamp sub-second precision. Splunk props.conf setup is required.

Methods

EmitBatchAsync(IReadOnlyCollection<LogEvent>)

public virtual Task EmitBatchAsync(IReadOnlyCollection<LogEvent> batch)

Parameters

batch IReadOnlyCollection<LogEvent>

Returns

Task

OnEmptyBatchAsync()

public virtual Task OnEmptyBatchAsync()

Returns

Task