在 CentOS 上查看 Filebeat 状态,可以通过以下几种常见方式(取决于你的安装方式)。
如果 Filebeat 是通过 RPM / YUM 安装的,一般都会注册为 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
如果只看到 grep filebeat,说明 Filebeat 未运行。
journalctl -u filebeat -f
tail -f /var/log/filebeat/filebeat
或:
ls /var/log/filebeat/
filebeat test config
filebeat test output
filebeat test config
并查看 Filebeat 日志中是否有类似:
Harvester started for file
| 安装方式 | 查看方式 |
|---|---|
| RPM / YUM | systemctl status filebeat |
| 二进制解压 | `ps -ef |
| Docker | docker ps / docker logs |
systemctl status filebeat
journalctl -u filebeat -n 50
filebeat test config
filebeat test output
如果你愿意,可以把 systemctl status filebeat 或日志内容贴出来,我可以帮你分析具体报错原因。