I’m new to elastic search. I’m working with .net 4.5. I added all the necessary tags to
NLogConfig.xml but still get exception:
Exception: NLog.NLogConfigurationException: Failed to create Target with unknown type-alias: ‘ElasticSearch’ – Verify type-alias and check extension is included.
NLogConfig.xml:
<?xml version="1.0" encoding="utf-8" ?>
<extensions>
<add assembly="NLog.Targets.ElasticSearch"/>
</extensions>
<targets>
<target name="console" xsi:type="Console" />
<!-- Uncomment the following lines for file logging -->
<target xsi:type="EventLog"
name="eventLog"
layout="${message}${newline}${exception:format=ToString}"
source="${event-properties:item=customSource}"
eventId="${event-properties:EventId:whenEmpty=0:item=costumEventId}" />
<target xsi:type="ElasticSearch" name="****DEV" index="elasticsearch" documentType=""
flushTimeout="5000">
<target xsi:type="ElasticSearch"
uri="http://****:9200/"
includeAllProperties ="true">
</target>
</target>
</targets>
<rules>
<!-- <logger name="*" levels="Info,Error,Debug,Warn,Trace,Fail" writeTo="console" /> -->
<logger name="*" levels="Info,Error" writeTo="console" />
<logger name="*" levels="Info,Debug,Error" writeTo="file" />
<!-- <logger name="*" levels="Error" writeTo="email" /> -->
<logger name="*" minlevel="Debug" writeTo="eventLog" />
<logger name="*" minlevel="Info,Debug,Error" writeTo="elasticsearch" />
</rules>