在 CentOS 上查看 Filebeat 状态,通常取决于你是通过 systemd 还是 直接运行。下面是最常见的几种方式:
systemctl status filebeat
输出示例:
● filebeat.service - Filebeat sends log files to Logstash or directly to Elasticsearch.
Loaded: loaded (/usr/lib/systemd/system/filebeat.service; enabled; vendor preset: disabled)
Active: active (running) since ...
systemctl is-enabled filebeat
enabled = 开机自启disabled = 未自启systemctl start filebeat
systemctl stop filebeat
systemctl restart filebeat
ps -ef | grep filebeat
或
pgrep -a filebeat
journalctl -u filebeat -f
常见路径:
/var/log/filebeat/filebeat
查看:
tail -f /var/log/filebeat/filebeat
filebeat test config
如果配置正常,会显示:
Config OK
filebeat test output
| 状态 | 含义 |
|---|---|
| active (running) | 正常运行 |
| inactive (dead) | 未运行 |
| failed | 启动失败 |
Unit filebeat.service could not be found说明可能是 手动运行 或 未注册 systemd 服务,可以直接运行:
filebeat -e -c /etc/filebeat/filebeat.yml
如果你愿意,可以告诉我:
我可以帮你进一步定位问题。