在 Debian 下 Filebeat 不采集(不发送、不读日志) 通常不是单一原因,下面按最常见 → 较少见的顺序给你排查清单,基本能覆盖 90% 的情况。
systemctl status filebeat
journalctl -u filebeat -n 50
如果没启动:
systemctl start filebeat
systemctl enable filebeat
Debian 下 Filebeat 默认配置路径是:
/etc/filebeat/filebeat.yml
而不是 /etc/filebeat.yml
✅ 检查:
ls -l /etc/filebeat/
❌ 常见错误:
/etc/filebeat.yml(不存在)/etc/filebeat/filebeat.yml示例(✅ 正确):
filebeat.inputs:
- type: log
enabled: true
paths:
- /var/log/nginx/*.log
❌ 常见错误:
enabled: false*,路径不存在)验证:
ls -l /var/log/nginx/access.log
Debian 下 Filebeat 默认用户:
filebeat
检查:
ps -ef | grep filebeat
如果日志文件权限是:
-rw------- root root
Filebeat 读不了
✅ 解决:
chmod 644 /var/log/nginx/*.log
# 或
usermod -aG adm filebeat
Filebeat 会记录已读位置:
/var/lib/filebeat/registry
如果你:
可能认为“已经采集完”
✅ 清空 registry(⚠️ 会重新采集):
systemctl stop filebeat
rm -rf /var/lib/filebeat/registry
systemctl start filebeat
output.elasticsearch:
hosts: ["http://localhost:9200"]
测试:
curl http://localhost:9200
output.logstash:
hosts: ["localhost:5044"]
验证端口:
ss -lntp | grep 5044
filebeat modules list
filebeat modules enable nginx
否则即使有日志也不采。
filebeat -e -c /etc/filebeat/filebeat.yml -d "*"
看是否有:
harvester startedpublish events/etc/filebeat/filebeat.yml如果你愿意,可以把下面内容贴出来,我可以直接帮你定位:
/etc/filebeat/filebeat.ymlsystemctl status filebeat我可以直接告诉你是哪一条卡住了。