Click or drag to resize

SplunkLayout Class

Splunk JSON-based, structured log format for Splunk Log Management.
Inheritance Hierarchy
SystemObject
  NLog.LayoutsLayout
    NLog.LayoutsJsonLayout
      NLog.LayoutsSplunkLayout

Namespace:  NLog.Layouts
Assembly:  NLog.Targets.Network (in NLog.Targets.Network.dll) Version: 6.0.0+be83582280f7a841b0d3c6ae75b4f95aaf07e914
Syntax
public class SplunkLayout : JsonLayout

The SplunkLayout type exposes the following members.

Constructors
  NameDescription
Public methodSplunkLayout
Initializes a new instance of the SplunkLayout class.
Top
Properties
  NameDescription
Public propertyAttributes
Gets the array of attributes' configurations.
(Inherited from JsonLayout.)
Public propertyExcludeEmptyProperties
Gets or sets the option to exclude null/empty properties from the log event (as JSON)
Public propertyExcludeProperties
List of property names to exclude when IncludeEventProperties is
Public propertyIncludeEventProperties
Gets or sets the option to include all properties from the log events
Public propertyIncludeGdc
Gets or sets a value indicating whether to include contents of the GlobalDiagnosticsContext dictionary.
(Inherited from JsonLayout.)
Public propertyIncludeScopeProperties
Gets or sets whether to include the contents of the ScopeContext properties-dictionary.
Public propertyIndentJson
Auto indent and create new lines
(Inherited from JsonLayout.)
Protected propertyLoggingConfiguration
Gets the logging configuration this target is part of.
(Inherited from Layout.)
Public propertyMaxRecursionLimit
How far should the JSON serializer follow object references before backing off
(Inherited from JsonLayout.)
Public propertyRenderEmptyObject
Gets or sets the option to render the empty object value {}
(Inherited from JsonLayout.)
Public propertySplunkFields
Gets the array of attributes for the "event"-section
Public propertySplunkHostName
Gets or sets Splunk Message Host-attribute
Public propertySplunkIndex
Gets or sets Splunk Message Index-attribute, that controls which event data is to be indexed.
Public propertySplunkSourceName
Gets or sets Splunk Message Source-attribute. Example the name of the application.
Public propertySplunkSourceType
Gets or sets Splunk Message SourceType-attribute. SourceType can be used hint for choosing Splunk Indexer
Public propertySuppressSpaces
Gets or sets the option to suppress the extra spaces in the output json.
(Inherited from JsonLayout.)
Top
Methods
  NameDescription
Protected methodCloseLayout
Closes the layout.
(Inherited from JsonLayout.)
Protected methodGetFormattedMessage
Renders formatted output using the log event as context.
(Inherited from JsonLayout.)
Protected methodInitializeLayout
Initializes the layout.
(Overrides JsonLayoutInitializeLayout.)
Public methodPrecalculate
Precalculates the layout for the specified log event and stores the result in per-log event cache. Skips context capture when Layout have [ThreadAgnostic], and only contains layouts with [ThreadAgnostic].
(Inherited from Layout.)
Public methodRender(LogEventInfo)
Renders formatted output using the log event as context.
(Inherited from Layout.)
Public methodRender(LogEventInfo, StringBuilder)
Optimized version of Render(LogEventInfo) that works best when override of RenderFormattedMessage(LogEventInfo, StringBuilder) is available.
(Inherited from Layout.)
Protected methodRenderFormattedMessage
Renders formatted output using the log event as context.
(Inherited from JsonLayout.)
Protected methodResolveServiceT
Resolve from DI ServiceRepository
(Inherited from Layout.)
Public methodToString
Returns a string that represents the current object.
(Inherited from JsonLayout.)
Top
Remarks
Examples

{ "time": 1426279439, // epoch time "host": "localhost", "source": "random-data-generator", "sourcetype": "my_sample_data", "index": "main", "event": { "message": "Something happened", "level": "Info" } }

See Also