在 Debian 上 Filebeat 采集失败 的原因非常多,下面按最常见 → 较少见的顺序系统梳理,并给出排查步骤和解决方法。你可以对照排查。
systemctl status filebeat
journalctl -u filebeat -n 50
✅ 解决:
systemctl enable filebeat
systemctl start filebeat
检查:
filebeat.inputs:
- type: log
enabled: true
paths:
- /var/log/nginx/*.log
常见错误:
enabled: false✅ 验证配置:
filebeat test config
Filebeat 默认以 filebeat 用户运行:
ps -ef | grep filebeat
ls -l /var/log/xxx.log
✅ 解决:
chmod 644 /var/log/xxx.log
chown root:filebeat /var/log/xxx.log
或加入组:
usermod -aG adm filebeat
aa-status | grep filebeat
✅ 解决:
aa-complain /usr/share/filebeat/bin/filebeat
filebeat test output
常见错误:
✅ 示例(ES):
output.elasticsearch:
hosts: ["https://es:9200"]
username: "filebeat"
password: "xxx"
ssl.verification_mode: none
rm -f /var/lib/filebeat/registry/*
systemctl restart filebeat
⚠ 会重新采集所有日志
Filebeat 依赖 inode。
✅ 建议:
close_inactive: 1h
scan_frequency: 10s
如果是 Docker:
paths:
- /var/lib/docker/containers/*/*.log
# 1. 服务状态
systemctl status filebeat
# 2. 配置语法
filebeat test config
# 3. 输出连通性
filebeat test output
# 4. 实时日志
journalctl -u filebeat -f
请贴出以下信息(可脱敏):
filebeat.yml(inputs + output 部分)systemctl status filebeatjournalctl -u filebeat -n 50cat /etc/os-release)我可以直接告诉你 是哪一条导致采集失败。