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
renderTemplateboolIf true, the template used will be rendered and written to the output as a property named MessageTemplate
renderMessageboolRemoves the "RenderedMessage" parameter from output JSON message.
formatProviderIFormatProviderSupplies 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
renderTemplateboolIf true, the template used will be rendered and written to the output as a property named MessageTemplate
renderMessageboolInclude "RenderedMessage" parameter in output JSON message.
formatProviderIFormatProviderSupplies culture-specific formatting information, or null.
sourcestringThe source of the event
sourceTypestringThe source type of the event
hoststringThe host of the event
indexstringThe Splunk index to log to
customFieldsCustomFieldsObject that describes extra splunk fields that should be indexed with event see: http://dev.splunk.com/view/event-collector/SP-CAAAFB6
subSecondPrecisionSubSecondPrecisionTimestamp 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
renderTemplateboolIf true, the template used will be rendered and written to the output as a property named MessageTemplate
renderMessageboolRemoves the "RenderedMessage" parameter from output JSON message.
formatProviderIFormatProviderSupplies culture-specific formatting information, or null.
sourcestringThe source of the event
sourceTypestringThe source type of the event
hoststringThe host of the event
indexstringThe Splunk index to log to
subSecondPrecisionSubSecondPrecisionTimestamp sub-second precision. Splunk props.conf setup is required.
Methods
Format(LogEvent, TextWriter)
public void Format(LogEvent logEvent, TextWriter output)
Parameters
logEventLogEventoutputTextWriter