Filebeat 日志采集器
filebeat 轻量采集文件和容器日志,转发到 Elasticsearch、Logstash 或 Kafka。它记录读取位置(registry),支持多行合并和模块化采集。
filebeat -e -c filebeat.yml
filebeat test config -c filebeat.yml
filebeat test output -c filebeat.yml
filebeat modules enable nginx
filebeat setup -e
filebeat export config
filebeat.yml:
filebeat.inputs:
- type: filestream
id: app-logs
paths:
- /var/log/app/*.log
parsers:
- multiline:
type: pattern
pattern: '^\d{4}-\d{2}-\d{2}'
negate: true
match: after
output.elasticsearch:
hosts: ["http://es:9200"]
setup 会创建索引模板/ILM;重复执行前确认不会覆盖自定义配置。logstash — 解析与转发elasticsearch — 存储vector — 另一种采集器合上页面,先回答,再展开对照。