使用 filebeat 在 elasticsearch 中获取 JSON 日志文件

Ingesting JSON Logfiles in elasticsearch with filebeats

我有一个 JSON 格式的自定义日志文件,我们使用的应用程序将为每个文件输出 1 个条目,如下所示

{"cuid":1,"Machine":"001","cuSize":0,"starttime":"2017-03-19T15:06:48.3402437+00:00","endtime":"2017-03-19T15:07:13.3402437+00:00","rejectcount":47,"fitcount":895,"unfitcount":58,"totalcount":1000,"processedcount":953}

我正在尝试将其提取到 ElasticSearch 中。我相信这是可能的,因为我正在使用 ES5.X

我已经配置了我的 FileBeat prospector,我现在尝试至少从文件中提取 1 个字段,即 Cuid

filebeat.prospectors:

input_type: log
json.keys_under_root : true
paths:
C:\Files\output*-Account-*
tags : ["json"]
output.elasticsearch:
# The Logstash hosts
hosts: ["10.1.0.4:9200"]
template.name: "filebeat"
template.path: "filebeat.template.json"
template.overwrite: true

processors:
- decode_json_fields: 
fields: ["cuid"]

当我启动 FileBeat 时,它似乎在收集文件,因为我在 FileBeat 注册表文件中获得了一个条目

2017-03-20T13:21:08Z INFO Harvester started for file: 

C:\Files\output[=13=]1-Account-20032017105923.json
2017-03-20T13:21:27Z INFO Non-zero metrics in the last 30s: filebeat.harvester.closed=160 publish.events=320 filebeat.harvester.started=160 registrar.states.update=320 registrar.writes=2

但是,我似乎无法在 Kibana 中找到数据。我不太确定如何找到它?

我已确保 FileBeat 模板已加载到 kibana 中。

我已尝试阅读文档,我认为我理解正确,但我仍然很模糊,因为我对堆栈完全陌生。

我仍然不完全确定这是否是正确的答案。但是我设法解决了我的特定问题。因为我们正在将多个 JSON 文件写到目录中,所有文件都只输入一行,如上所述。尽管 FileBeats 似乎在收集文件,但我不认为它在读取文件。

我修改了应用程序以使用 log4Net,并实现了 RollingFileAppender,然后我 运行 应用程序开始将日志发送到目录,如果神奇的话,没有修改我的 Filebeat.yml一切刚刚开始。

我只能得出结论,Filebeats 不能处理多行 json 文件。除非有一些我不知道的其他配置。