Class SplunkJsonFormatter
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
boolIf true, the template used will be rendered and written to the output as a property named MessageTemplate
renderMessage
boolRemoves the "RenderedMessage" parameter from output JSON message.
formatProvider
IFormatProviderSupplies 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
boolIf true, the template used will be rendered and written to the output as a property named MessageTemplate
renderMessage
boolInclude "RenderedMessage" parameter in output JSON message.
formatProvider
IFormatProviderSupplies culture-specific formatting information, or null.
source
stringThe source of the event
sourceType
stringThe source type of the event
host
stringThe host of the event
index
stringThe Splunk index to log to
customFields
CustomFieldsObject that describes extra splunk fields that should be indexed with event see: http://dev.splunk.com/view/event-collector/SP-CAAAFB6
subSecondPrecision
SubSecondPrecisionTimestamp 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
boolIf true, the template used will be rendered and written to the output as a property named MessageTemplate
renderMessage
boolRemoves the "RenderedMessage" parameter from output JSON message.
formatProvider
IFormatProviderSupplies culture-specific formatting information, or null.
source
stringThe source of the event
sourceType
stringThe source type of the event
host
stringThe host of the event
index
stringThe Splunk index to log to
subSecondPrecision
SubSecondPrecisionTimestamp sub-second precision. Splunk props.conf setup is required.
Methods
Format(LogEvent, TextWriter)
public void Format(LogEvent logEvent, TextWriter output)
Parameters
logEvent
LogEventoutput
TextWriter