在 CentOS 上 Filebeat 报错是很常见的问题,但“怎么报错”要看你指的是 怎么查看报错,还是 常见报错有哪些。我分两部分说,你可以对照看。
systemctl status filebeat
journalctl -u filebeat -f
filebeat -e -c /etc/filebeat/filebeat.yml
-e表示输出到标准错误,方便看实时报错
tail -f /var/log/filebeat/filebeat
报错示例
Exiting: error loading config file: config file ("/etc/filebeat/filebeat.yml") can only be writable by the owner
或
Permission denied
✅ 解决:
chown root:root /etc/filebeat/filebeat.yml
chmod 644 /etc/filebeat/filebeat.yml
报错示例
YAML config parsing failed
或
did not find expected key
✅ 解决:
filebeat test config
检查:
报错示例
connection attempt failed
EOF
✅ 检查:
firewall-cmd --list-all
telnet es_ip 9200
现象
✅ 解决:
setenforce 0
或永久关闭 / 配置 SELinux 策略
报错示例
No files found for given paths
✅ 检查:
ls -l /var/log/xxx.log
确认 filebeat.yml 中 paths 是否正确
filebeat test config
filebeat test output
systemctl restart filebeat
如果你愿意,可以把 具体的报错信息贴出来(红字部分),我可以直接帮你定位到根因 ✅