排查Ubuntu上Filebeat故障可按以下步骤进行:
检查服务状态:
sudo systemctl status filebeat # 查看是否运行,未运行则启动
sudo systemctl start filebeat
查看日志文件:
sudo tail -f /var/log/filebeat/filebeat # 分析错误信息
验证配置文件:
filebeat -c /etc/filebeat/filebeat.yml validate # 检查语法错误
确保`paths`(日志路径)、`output`(输出目标)等配置正确。
确认权限与路径:
sudo chmod 644 /path/to/logfile # 调整文件权限
ls -l /path/to/logfile
排查网络与防火墙:
ping <目标IP>
telnet <目标IP> <端口> # 如9200(ES默认端口)
sudo ufw allow <端口>
检查依赖服务:
sudo systemctl status elasticsearch
sudo systemctl status logstash
性能与资源监控:
top
或htop
查看系统资源(CPU/内存)是否充足。batch_size
、close_inactive
等参数优化性能(参考官方文档)。版本兼容性:
重新安装Filebeat:
参考来源: