Table of Contents

Class SplunkJsonFormatter

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

Renders log events into a default JSON format for consumption by Splunk.

public class SplunkJsonFormatter : ITextFormatter
Inheritance
SplunkJsonFormatter
Implements
ITextFormatter
Inherited Members

Constructors

SplunkJsonFormatter(bool, bool, IFormatProvider)

Construct a SplunkJsonFormatter.

public SplunkJsonFormatter(bool renderTemplate, bool renderMessage, IFormatProvider formatProvider)

Parameters

renderTemplate bool

If true, the template used will be rendered and written to the output as a property named MessageTemplate

renderMessage bool

Removes the "RenderedMessage" parameter from output JSON message.

formatProvider IFormatProvider

Supplies culture-specific formatting information, or null.

SplunkJsonFormatter(bool, bool, IFormatProvider, string, string, string, string, CustomFields, SubSecondPrecision)

Construct a SplunkJsonFormatter.

public SplunkJsonFormatter(bool renderTemplate, bool renderMessage, IFormatProvider formatProvider, string source, string sourceType, string host, string index, CustomFields customFields, SubSecondPrecision subSecondPrecision = SubSecondPrecision.Milliseconds)

Parameters

renderTemplate bool

If true, the template used will be rendered and written to the output as a property named MessageTemplate

renderMessage bool

Include "RenderedMessage" parameter in output JSON message.

formatProvider IFormatProvider

Supplies culture-specific formatting information, or null.

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

customFields CustomFields

Object that describes extra splunk fields that should be indexed with event see: http://dev.splunk.com/view/event-collector/SP-CAAAFB6

subSecondPrecision SubSecondPrecision

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

SplunkJsonFormatter(bool, bool, IFormatProvider, string, string, string, string, SubSecondPrecision)

Construct a SplunkJsonFormatter.

public SplunkJsonFormatter(bool renderTemplate, bool renderMessage, IFormatProvider formatProvider, string source, string sourceType, string host, string index, SubSecondPrecision subSecondPrecision = SubSecondPrecision.Milliseconds)

Parameters

renderTemplate bool

If true, the template used will be rendered and written to the output as a property named MessageTemplate

renderMessage bool

Removes the "RenderedMessage" parameter from output JSON message.

formatProvider IFormatProvider

Supplies culture-specific formatting information, or null.

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

subSecondPrecision SubSecondPrecision

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

Methods

Format(LogEvent, TextWriter)

public void Format(LogEvent logEvent, TextWriter output)

Parameters

logEvent LogEvent
output TextWriter