2016-11-24 883 views
0

我已经将Logstash配置为直接选取文件(Gatling日志),使用自定义逻辑处理它们,并发送给Elasticsearch。它工作正常。我现在试图设置Filebeat来将文件发送给它。如何检查Filebeat发送到Logstash的内容?

基本知识似乎工作,因为我看到新的entires结束在Elasticsearch,但他们看起来都错了。我的理论是Logstash被配置为解析Gatling日志,但Filebeat不直接发送日志,而是一些JSON或包含元数据的其他格式,而Logstash需要重新配置才能解析此日志。

但是...如何找出Filebeat发送的内容?格式记录在某处吗?

+0

这是否回答你的问题https://www.elastic.co/guide/en/beats/filebeat/current/logstash-output.html? – baudsp

+0

@baudsp差不多。它解释了元数据部分,但不是实际消息(文件内容)的位置。或者,也许我在看这个全错了:( – kaqqao

+0

不知道这可能是什么。也许你的输入上有编解码器会导致问题 – baudsp

回答

1

添加设置filebeat.yml

,你可以看到输出日志文件为您的路径,看看发生了什么。

output.file: 
# Boolean flag to enable or disable the output module. 
enabled: true 

# Path to the directory where to save the generated files. The option is 
# mandatory. 
path: "your path" 

# Name of the generated files. The default is `filebeat` and it generates 
# files: `filebeat`, `filebeat.1`, `filebeat.2`, etc. 
filename: filebeat 

# Maximum size in kilobytes of each file. When this size is reached, and on 
# every filebeat restart, the files are rotated. The default value is 10240 
# kB. 
#rotate_every_kb: 10000 

# Maximum number of files under path. When this number of files is reached, 
# the oldest file is deleted and the rest are shifted from last to first. The 
# default is 7 files. 
number_of_files: 7 

,如果你想看到的网络设置

请添加设置查看日志。

logging.level: warning 
logging.to_files: true 
logging.to_syslog: false 
logging.files: 
    path: /var/log/mybeat 
    name: mybeat.log 
    keepfiles: 7