问题
We have a .Net web application and we were already logging to csv file. We just started logging with Elastic search. I am able to see a log on Kibana but none of the information from application added to LogEventInfo is visible here though I can see that contentLength is changed based on length of information sent. I can only see http details in Kibana for each log. Can you let me know what could be the issue.
Configuration looks like
<target name="elastic" xsi:type="BufferingWrapper" flushTimeout="5000">
<target xsi:type="ElasticSearch" uri="http://<url>:<portNumber>/">
<field name ="MachineName" layout="${machinename}" layoutType="System.String" />
</target>
</target>
Data like Machine Name is not shown on Kibana, I can see it in csv log created simultaneously.
nlog configuration. Rule in configuration section to write log
" <logger name="*" minLevel="Info" writeTo="elk" enabled="true" />"
Data is logged using following code:
var theEvent= new LogEventInfo( logLevel,this.logger.Name,activityInfo.LogMessage // The message to log. );
theEvent.Properties[APPLICATION_NAME] = applicationName;
theEvent.Properties[ACTIVITY_NAME] = activityInfo.ActivityName;
this.logger.Log (theEvent); –
回答1:
Try adding the property IncludeAllProperties=true to your target.
来源:https://stackoverflow.com/questions/53272531/data-from-web-application-not-getting-passed-to-elasticsearch