【问题标题】:Data from web Application not getting passed to ElasticSearch来自 Web 应用程序的数据未传递到 ElasticSearch
【发布时间】:2019-04-15 18:51:56
【问题描述】:

我们有一个 .Net Web 应用程序,并且我们已经在记录到 csv 文件。我们刚刚开始使用 Elastic search 进行日志记录。我可以在 Kibana 上看到日志,但此处没有显示来自应用程序添加到 LogEventInfo 的信息,尽管我可以看到 contentLength 根据发送的信息长度而更改。我只能在 Kibana 中查看每个日志的 http 详细信息。你能告诉我可能是什么问题吗?

配置看起来像

<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>

Kibana 上不显示机器名称等数据,我可以在同时创建的 csv 日志中看到它。

nlog 配置。配置部分规则写入日志

" <logger name="*" minLevel="Info" writeTo="elk" enabled="true" />" 

使用以下代码记录数据:

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); –

【问题讨论】:

  • 配置什么?日志数据如何记录到 ES 中?
  • nlog 配置。配置部分中写入日志的规则“” 使用以下代码记录数据: var theEvent= new LogEventInfo( logLevel,this. logger.Name,activityInfo.LogMessage // 要记录的消息。); theEvent.Properties[APPLICATION_NAME] = 应用程序名称; theEvent.Properties[ACTIVITY_NAME] = activityInfo.ActivityName; this.logger.Log (theEvent);

标签: asp.net elasticsearch logging nlog


【解决方案1】:

尝试将属性 IncludeAllProperties=true 添加到您的目标。

【讨论】:

  • 我试过没有用。我在我的项目中找不到logstash。是否可能缺少 logstash 配置,因此没有传递来自应用程序的数据?
猜你喜欢
  • 2013-12-15
  • 1970-01-01
  • 2016-10-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-01-21
  • 2015-08-02
  • 2013-03-07
相关资源
最近更新 更多