我有一个应用程序服务器,我在其中配置了filebeat(通过Chef)来提取日志并将其发布到logstash(一个单独的ELK服务器),然后发布到ES和Kibana。
我已经将filebeat配置为仅处理/opt/app_ logs /*.log中的日志,但它似乎也在读取其他位置的日志,因为在/etc/filebeat配置目录中,我有自动生成的filebeat.full.yml和其他yml文件,并且它们似乎具有所有其他文件位置,因此由于有如此大量的日志,logstash.log的logstash服务在几分钟内就会耗尽内存。如何不自动生成其他yml文件?我尝试删除此文件,并尝试注释掉浏览程序中的所有/var/log路径,但是filebeat本身无法启动。
filebeat.yml文件:
filebeat:
prospectors: []
registry_file: "/var/lib/filebeat/registry"
config_dir: "/etc/filebeat"
output:
logstash:
hosts:
- elk_host:5044
index: logstash-filebeat
shipper:
name: serverA
tags:
- A
logging:
to_files: 'true'
files:
path: "/var/log/filebeat"
name: filebeat_log
rotateeverybytes: '10485760'
level: info
prospectors:
- paths:
- "/opt/app_logs/*.log"
encoding: plain
input_type: log
ignore_older: 24h
发布于 2017-01-17 07:41:20
您的配置的主要问题是,对于Filebeat 1.2.3,您定义了两次prospectors
列表,而第二个列表的位置不正确。
第二个问题是您已经将config_dir
定义为/etc/filebeat
。config_dir
用于指定在其中查找配置文件的附加目录。它永远不应该设置为/etc/filebeat
,因为这是主配置文件应该位于的位置。有关用法信息,请参阅https://stackoverflow.com/a/39987501/503798。
第三个问题是您在to_files
和rotateeverybytes
中使用了字符串类型。它们应该分别是布尔型和整型。
下面是Filebeat 1.x的配置应该是什么样子。
filebeat:
registry_file: "/var/lib/filebeat/registry"
config_dir: "/etc/filebeat/conf.d"
prospectors:
- paths:
- "/opt/app_logs/*.log"
encoding: plain
input_type: log
ignore_older: 24h
output:
logstash:
hosts:
- elk_host:5044
index: logstash-filebeat
shipper:
name: serverA
tags:
- A
logging:
to_files: true
files:
path: "/var/log/filebeat"
name: filebeat_log
rotateeverybytes: 10485760
level: info
我强烈建议您升级到Filebet5.x,因为它使用filebeat -configtest
进行了更好的配置验证。
https://stackoverflow.com/questions/41631508
复制相似问题