Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Rolf Kristensen edited this page Jul 2, 2025 · 3 revisions

A specialized layout that renders to Graylog Extended Log Format (GELF) which produces JSON output.

Platforms Supported: All - Requires nuget-package NLog.Targets.Network

<target name="jsonFile" xsi:type="File" fileName="gelf-file.json" >
      <layout xsi:type="GelfLayout" includeEventProperties="Boolean" excludeProperties="Comma-separated list (string)">
              <GelfField name="threadid" layout="${threadid}" />
       </layout>
</target>

Layout Options

  • GelfHostName - Graylog Message Host-field. Default = ${hostname}

  • GelfShortMessage - Graylog Message Short-Message-field (Truncates when longer than 250 chars). Default = ${message}

  • GelfFullMessage - Graylog Message Full-Message-field. Default = ${message}

  • GelfFacility - Legacy Graylog Message Facility-field. Default = null

  • IncludeEventProperties - Include all properties from the log events. Default = true.

  • IncludeScopeProperties - Include all scope-properties from the ScopeContext. Default = false.

  • ExcludeEmptyProperties - Exclude null/empty properties. Default = false.

  • ExcludeProperties - Comma separated string with names which properties to exclude.

  • IncludeProperties - Comma separated string with names which properties to explicitly include.

  • GelfField

    • name - Required. The name of the JSON-key
    • layout - The layout for the JSON-value (Can be a nested JsonLayout)
Clone this wiki locally