在 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
✅ 能看到进程说明 Filebeat 正在运行
❌ 没有输出说明未运行
配置错误是 Filebeat 启动失败的常见原因。
filebeat test config
检查输出是否正常,例如:
Config OK
filebeat test output
journalctl -u filebeat -f
通常在:
/var/log/filebeat/filebeat
查看最新日志:
tail -f /var/log/filebeat/filebeat
ls -lh /var/lib/filebeat/registry/
curl -X GET "http://localhost:9200/_cat/indices?v"
| 问题 | 排查方式 |
|---|---|
| Filebeat 起不来 | journalctl -u filebeat |
| 配置错误 | filebeat test config |
| 无法连接 ES | filebeat test output |
| 没采集到日志 | 检查 paths 和权限 |
systemctl status filebeat
ps -ef | grep filebeat
filebeat test config
journalctl -u filebeat -n 50
如果你愿意,可以把 systemctl status filebeat 或日志输出贴出来,我可以帮你具体分析为什么 Filebeat 没正常工作。