在 Ubuntu 上开启 Filebeat 调试(debug) 通常有几种方式,按使用场景从简单到完整说明:
运行 Filebeat 时加 -d 参数:
sudo filebeat -e -d "*"
说明:
-e:日志直接输出到终端(stderr)-d "*":开启所有调试模块sudo filebeat -e -d "publish,registrar,input"
适合 临时排查问题。
编辑配置文件:
sudo vim /etc/filebeat/filebeat.yml
在末尾或适当位置添加:
logging.level: debug
logging.to_files: true
logging.files:
path: /var/log/filebeat
name: filebeat
keepfiles: 7
permissions: 0644
然后重启:
sudo systemctl restart filebeat
查看日志:
tail -f /var/log/filebeat/filebeat
logging.level: debug
logging.to_files: false
logging.to_stderr: true
适合容器或临时调试。
http.enabled: true
http.host: localhost
http.port: 5066
然后访问:
curl http://localhost:5066/state
curl http://localhost:5066/inputs
确认 filebeat 是否在运行
systemctl status filebeat
测试配置是否正确
sudo filebeat test config
sudo filebeat test output
调试输入不到 ES / Logstash
sudo filebeat -e -d "publish,output"
如果你能告诉我:
我可以给你更精确的调试方案。