在 Debian 系统中,Filebeat 不运行通常有下面几类原因。你可以按顺序排查。
systemctl status filebeat
常见状态:
inactive (dead) → 没有启动failed → 启动失败systemctl start filebeat
systemctl enable filebeat
Filebeat 对 filebeat.yml 非常敏感。
filebeat test config
如果有错误,会直接提示行号和原因。
output.elasticsearch 或 output.logstash 配置错误filebeat.inputs: 或 paths: 写错示例正确结构:
filebeat.inputs:
- type: log
paths:
- /var/log/*.log
output.elasticsearch:
hosts: ["localhost:9200"]
Debian 中 Filebeat 通常以 filebeat 用户运行。
检查日志文件权限:
ls -l /var/log/xxx.log
解决方式:
usermod -aG adm filebeat
或确保日志可被读取。
ls -ld /var/lib/filebeat
应为:
filebeat filebeat
修复:
chown -R filebeat:filebeat /var/lib/filebeat
如果配置了:
output.elasticsearch:
hosts: ["localhost:9200"]
但 Elasticsearch 没启动或端口不对,Filebeat 会:
测试:
curl localhost:9200
journalctl -u filebeat -xe
tail -f /var/log/filebeat/filebeat
有些情况下只是装了但没注册服务:
dpkg -l | grep filebeat
如果没有 systemctl 单元:
filebeat setup
systemctl status filebeatfilebeat test configjournalctl -u filebeat如果你愿意,可以把下面内容贴出来,我可以直接帮你定位:
systemctl status filebeat 输出filebeat test config 输出filebeat.yml 关键配置(可脱敏)