Skip to content
Rolf Kristensen edited this page Nov 14, 2018 · 48 revisions

Configuration Syntax

<targets>
  <target xsi:type="ElasticSearch" 
          name="String"
          uri="String"
          index="Layout"
          documentType="Layout"
          includeAllProperties="Boolean"
          excludedProperties="String"
          connectionStringName="String"
          disableAutomaticProxyDetection="Boolean"
          requireAuth="Boolean"
          username="String"
          password="String">
    <field name="String" layout="Layout" layoutType="Type" /><!-- repeated, optional -->
  </target>
</targets>

Parameters

  • name - Name of the target. String
  • uri - Uri of a Elasticsearch node. Multiple can be passed comma separated. String Default: http://localhost:9200
  • index - Index to write to, if it doesn't exist it will be created. Layout Default: logstash-${date:format=yyyy.MM.dd}
  • documentType - Type of document. Layout Default: logevent
  • fields - A collection of fields. Each field contains a mapping between a NLog layout and a named field.
    • name - Name of the field. String
    • layout - Layout that should be used to calculate the value for the field. Layout
    • layoutType - .Net type to convert the field into. Type Default: System.String
  • includeAllProperties - Optionally include all properties from the log event. Boolean Default: False
  • excludedProperties - Works with includeAllProperties to exclude specific properties. String
  • connectionStringName - Optionally retrieve the Uri from a connection string. String
  • disableAutomaticProxyDetection (since version 2.0.5) - Optionally disable automatic proxy detection. Boolean
  • requireAuth - Optionally enable basic authentication. Boolean Default: False
  • username - Username for basic authentication. String
  • password - Password for basic authentication. String

Including MDLC as Field (NET Core - BeginScope)

<target xsi:type="ElasticSearch">
    <field name="mdlc" layoutType="System.Object">
        <layout xsi:type="JsonLayout" includeMdlc="true" />
    </field>
</target>
Clone this wiki locally