在 CentOS 上查看 Filebeat 运行状态,常用有以下几种方式,按使用场景从最常见到进阶说明:
如果 Filebeat 是通过 RPM 包 安装的(官方推荐方式),它通常以 systemd 服务运行。
systemctl status filebeat
常见状态说明:
active (running) ✅ 正常运行inactive (dead) ❌ 已停止failed ❌ 启动失败systemctl start filebeat
systemctl stop filebeat
systemctl restart filebeat
systemctl enable filebeat
ps -ef | grep filebeat
或:
pgrep -a filebeat
✅ 有输出说明正在运行
❌ 无输出说明未运行
journalctl -u filebeat -f
查看历史日志:
journalctl -u filebeat --since "10 min ago"
默认路径(取决于配置):
/var/log/filebeat/filebeat
查看:
tail -f /var/log/filebeat/filebeat
filebeat test config
filebeat test output
ls -lh /var/lib/filebeat/registry/
registry 文件存在且更新,说明 Filebeat 正常运行并采集日志
lsof -p $(pgrep filebeat)
查看详细错误:
journalctl -u filebeat -xe
检查:
filebeat.yml 中的 paths临时关闭 SELinux 测试:
setenforce 0
systemctl status filebeat
ps -ef | grep filebeat
journalctl -u filebeat -f
filebeat test config
filebeat test output
如果你愿意,可以把 systemctl status filebeat 的输出 或 filebeat.yml 配置贴出来,我可以帮你精确分析为什么没运行或没采集日志。