排查 CentOS 上 Filebeat 错误,可以按下面步骤系统性地检查(从最常见到进阶)。
systemctl status filebeat
常见状态:
active (running) ✅ 正常failed ❌ 启动失败inactive ❌ 未启动systemctl start filebeat
systemctl restart filebeat
systemctl enable filebeat
journalctl -u filebeat -f
tail -f /var/log/filebeat/filebeat
常见错误:
permission deniedno such file or directoryconnection refusedparse errorfilebeat test config
如果报错:
Exiting: error loading config file
说明 filebeat.yml 有语法错误。
filebeat test output
常见问题:
ps -ef | grep filebeat
通常是 root 或 filebeat
ls -l /var/log/xxx.log
如果 Filebeat 不是 root:
chmod 644 /var/log/xxx.log
chown root:root /var/log/xxx.log
或允许 Filebeat 读取:
setfacl -m u:filebeat:r /var/log/xxx.log
Err: Failed to read file: permission denied
✅ 解决:
connection refused
✅ 检查:
curl http://localhost:9200
确认:
yaml: line 12: mapping values are not allowed here
✅ 解决:
filebeat test config
no such file or directory
✅ 解决:
paths 是否正确paths:
- /var/log/*.log
filebeat -e -d "*"
logging.level: debug
logging.to_files: true
日志位置:
/var/log/filebeat/
✅ systemctl status filebeat
✅ journalctl -u filebeat -f
✅ filebeat test config
✅ filebeat test output
✅ 日志文件是否存在、可读
✅ ES / Logstash 是否可访问
如果你愿意,可以把 具体报错日志 或 filebeat.yml 配置贴出来,我可以直接帮你定位问题。