如何检查 Filebeat 发送到 Logstash 的内容?

How to check what Filebeat is sending to Logstash?

我已经将 Logstash 配置为直接获取文件(Gatling 日志),使用自定义逻辑处理它们,然后发送到 Elasticsearch。它工作正常。我现在正在尝试设置 Filebeat 以将文件发送给它。

当我看到新的整体最终出现在 Elasticsearch 中时,基础知识似乎是有效的,但它们看起来完全不对。我的理论是 Logstash 配置为解析 Gatling 日志,但 Filebeat 不直接发送日志,而是一些 JSON 或其他包含元数据的格式,并且需要重新配置 Logstash 来解析它。

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

将设置添加到 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