CentOS 上 Filebeat 故障排查步骤
一 快速定位流程
sudo systemctl status filebeat -lsudo journalctl -xe -u filebeat.serviceyamllint /etc/filebeat/filebeat.ymlfilebeat.inputs.paths、output.elasticsearch 或 output.logstash 的主机、端口、认证、SSL 配置sudo tail -f /var/log/filebeat/filebeattelnet logstash-host 5044curl -X GET "http://es-host:9200"ps -ef | grep filebeatls -l /var/log/...;必要时调整属主或以合适用户运行sudo systemctl restart filebeat && sudo journalctl -u filebeat -f二 常见故障与修复要点
journalctl -xe -u filebeat.service 定位具体报错;常见为配置语法错误、端口冲突、权限不足systemctl reset-failed filebeat.service && systemctl start filebeatyamllint 校验;核对 hosts、index、username/password、ssl 等关键项paths 正确;若日志被轮转删除,启用 close_removed: true 以避免句柄占用与采集异常sudo netstat -tuln | grep <端口号>;修改配置或更换端口telnet/curl 测试到 Logstash 5044 或 Elasticsearch 9200 的连通性;排查防火墙/安全组策略top/htop 观察 CPU/内存;优化采集并发与批处理参数,或扩容节点三 关键配置与命令清单
systemctl status filebeat -lsystemctl start filebeat && systemctl enable filebeatjournalctl -u filebeat -fyamllint /etc/filebeat/filebeat.ymlfilebeat.inputs:
- type: log
enabled: true
paths:
- /var/log/*.log
output.elasticsearch:
hosts: ["http://es-host:9200"]
username: "es_user"
password: "es_password"
output.logstash:
hosts: ["logstash-host:5044"]
logging.level: debug
sudo firewall-cmd --add-port=5044/tcp --permanent && sudo firewall-cmd --reload四 仍未恢复时的建议