-
Notifications
You must be signed in to change notification settings - Fork 89
Home
Rolf Kristensen edited this page Nov 13, 2020
·
48 revisions
<targets>
<target xsi:type="ElasticSearch"
name="String"
uri="Layout"
cloudId="Layout"
index="Layout"
documentType="Layout"
includeAllProperties="Boolean"
excludedProperties="String"
disableAutomaticProxyDetection="Boolean"
requireAuth="Boolean"
username="Layout"
password="Layout">
<field name="String" layout="Layout" layoutType="Type" /><!-- repeated, optional -->
</target>
</targets>
- name - Name of the target. String
- uri - Uri of a Elasticsearch node. Multiple can be passed comma separated. Ignored if cloud id is provided. Layout Default: http://localhost:9200
-
cloudId - Id of an elastic cloud hosted deployment. Layout Default:
empty
- 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: _doc
Version 7.2 (and older) used the default
logevent
but it has now been deprecated. -
opCodeCreate (since version 7.5.0) - Change OpCode from the default
index
tocreate
for support of data-streams in Elastic 7.9 Boolean - fields - A collection of fields. Each field contains a mapping between a NLog layout and a named field.
- includeAllProperties - Optionally include all properties from the log event. Boolean Default: False
- excludedProperties - Works with includeAllProperties to exclude specific properties. String
-
maxRecursionLimit - Limits how far the reflection will go down the object graph. Introduce with 7.2.0. Default: -1
- -1 = No limits without reference loop checking (Default - Can give stackoverflow/deadlock for complex objects)
- 0 = No reflection only perform object ToString
- 1 = Simple reflection where only direct properties are included.
- 2 = Full reflection but with checking of reference loops
- disableAutomaticProxyDetection (since version 2.0.5) - Optionally disable automatic proxy detection. Boolean
- disablePing (since version 5.1.0) - Set it to true to disable use of ping to checking if node is alive. Boolean
- enableHttpCompression (since version 5.1.0) - Set it to true to enable HttpCompression (Must be enabled on server). Boolean
- disableCertificateValidation (since version 7.2.0) - Set it to true to disable SSL certificate validation. Boolean
- pipeline (since version 5.1.0) -Optionally configure pipeline. Layout
- proxyAddress (since version 7.2.0) - Optionally configure proxy address. Layout
- proxyUserName (since version 7.2.0) - Optionally configure proxy login username. Layout
- proxyPassword (since version 7.2.0) - Optionally configure proxy login password. Layout
- requireAuth - Optionally enable basic authentication. Boolean Default: False
- username - Username for basic authentication. Must be provided when using elastic cloud. Layout
- password - Password for basic authentication. Must be provided when using elastic cloud. Layout
<target xsi:type="ElasticSearch">
<field name="mdlc" layoutType="System.Object">
<layout xsi:type="JsonLayout" includeMdlc="true" />
</field>
</target>
{
"ConnectionStrings": {
"ElasticUrl": "http://localhost:9200"
}
}
Can be extracted using ${configsetting} from NLog.Extensions.Logging nuget package:
${configsetting:item=ConnectionStrings.ElasticUrl}
<configuration>
<connectionStrings>
<add name="ElasticUrl" connectionString="http://localhost:9200"/>
</connectionStrings>
</configuration>
Can be extracted using ${appsetting} from when using NLog 4.6.5:
${appsetting:item=ConnectionStrings.ElasticUrl}