在 Debian 上调试 Filebeat,通常从「日志 → 配置 → 命令行调试 → 模块/管道 → 系统服务」几个方面入手。下面给你一套实用调试流程。
journalctl -u filebeat -f
Debian 默认日志位置:
/var/log/filebeat/filebeat
查看最近错误:
tail -n 100 /var/log/filebeat/filebeat
filebeat test config
filebeat test output
systemctl stop filebeat
filebeat -e -c /etc/filebeat/filebeat.yml -d "*"
参数说明:
-e:输出到 stderr-d "*":开启所有 debug 日志(可调成 -d "publish,registrar")/var/lib/filebeat/registry/filebeat/log.json
注意:Filebeat 7.x 之后 registry 是 data.json 或 log.json
filebeat.inputs:
- type: log
paths:
- /tmp/test.log
然后:
echo "hello filebeat" >> /tmp/test.log
观察 debug 输出。
filebeat modules list
filebeat modules enable system
filebeat test config
filebeat export template
检查:
paths 是否正确ls -l /var/log/xxx.log
filebeat test output
常见原因:
harvester_limit: 100
logging.level: debug
logging.selectors: ["*"]
或命令行:
filebeat -e -d "*"
systemctl status filebeat
journalctl -u filebeat -n 50
filebeat test config
filebeat test output
filebeat -e -d publish
如果你愿意,可以贴出:
我可以直接帮你定位问题。