首页/云/可观测性速查/Filebeat 采集配置入门
本包目录(282 条)
监控体系与方法40 条Prometheus 与采集64 条Grafana 与看板53 条
日志平台52 条
链路追踪23 条告警与响应50 条

Filebeat 采集配置入门

Filebeat 按输入声明要采集的文件路径:字段富化、多行合并、输出目标都在同一份配置里;先 test config 再启动是稳定运行的基本功。

可观测性速查云更新于 2026-10-12

filebeat.yml 示例

filebeat.yml 示例
filebeat.inputs:
  - type: filenames
    paths:
      - /var/log/app/*.log
    fields:
      service: api
    fields_under_root: true

output.elasticsearch:
  hosts: ["http://es:9200"]
  index: "filebeat-%{+yyyy.MM.dd}"

校验与运行

校验与运行
filebeat test config -c /etc/filebeat/filebeat.yml
filebeat test output
filebeat -e -c /etc/filebeat/filebeat.yml   # 前台带日志运行
fields 默认挂在 fields.* 下,fields_under_root: true 后置于顶层,便于后续按字段过滤。

易错点

  • 通配过宽把轮转备份文件(.1 .gz)也采进来,排除规则要显式写
  • 改了输出目标未重启服务不生效,test output 通过再逐步上线

数据来源与参考

  • Elastic 官方文档 · Filebeat configuration
​‌‌​​‌​​​‌‌​‌‌‌‌​‌‌​​​‌‌​‌‌‌​​‌‌​​‌​‌‌‌​​‌‌‌​​​‌​‌‌​‌​​‌​‌‌‌​​​‌​‌‌​‌​​‌​‌‌​​​‌‌​‌‌‌​‌​​​‌‌​‌‌‌‌​​‌​‌‌‌​​‌‌​​​‌‌​‌‌​‌‌‌‌​‌‌​‌‌​‌