【问题标题】:How to check what Filebeat is sending to Logstash?如何检查 Filebeat 发送到 Logstash 的内容?
【发布时间】:2017-04-08 20:55:57
【问题描述】:

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

当我看到新的整体最终出现在 Elasticsearch 中时,基础似乎可以工作,但它们看起来都错了。我的理论是 Logstash 被配置为解析 Gatling 日志,但 Filebeat 不直接发送日志,而是包含一些 JSON 或其他格式的元数据,并且需要重新配置 Logstash 来解析这个。

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

【问题讨论】:

  • @baudsp 差不多。它解释了元数据部分,但没有解释实际消息(文件内容)的去向。或者也许我看错了:(
  • 不知道这可能在哪里。也许您的输入中有一个导致问题的编解码器。
  • 确保您在 Logstash 配置中使用 beats 输入,并且您没有将编解码器应用于该输入。日志行发送到message 字段。发布您的 Filebeat 和 Logstash 配置会有所帮助。

标签: logstash elastic-stack filebeat


【解决方案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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-10-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-08-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多