我有一个 elasticsearch 集群 (ELK),一些节点使用 filebeat 将日志发送到 logstash。我环境中的所有服务器都是 CentOS 6.5。
每个服务器中的 filebeat.yml 文件由 Puppet 模块强制执行(我的生产服务器和测试服务器都有相同的配置)。
我想在每个文档中都有一个字段来判断它是否来自生产/测试服务器。
我想在每个文档中生成一个动态自定义字段,它使用 filebeat.yml 文件指示环境(生产/测试)。
为了解决这个问题,我想运行一个返回环境的命令(可以通过事实了解环境)并将其添加到 filebeat.yml 文件中的“环境”自定义字段下,但我不能'找不到这样做的任何方法。
是否可以通过 filebeat.yml 运行命令? 还有其他方法可以实现我的目标吗?
最佳答案
在你的 filebeat.yml 中:
filebeat:
prospectors:
-
paths:
- /path/to/my/folder
input_type: log
# Optional additional fields. These field can be freely picked
# to add additional information to the crawled log files
fields:
mycustomvar: production
关于elasticsearch - 生成 filebeat 自定义字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36493362/