温馨提示×

CentOS如何查看Filebeat状态

小樊
43
2026-07-08 17:00:19
栏目: 智能运维

CentOS 上查看 Filebeat 状态,可以通过以下几种常见方式(取决于你的安装方式)。


一、使用 systemd(最常见,推荐)

如果 Filebeat 是通过 RPM / YUM 安装的,一般都会注册为 systemd 服务。

1️⃣ 查看 Filebeat 运行状态

systemctl status filebeat

常见状态说明:

  • active (running) ✅ 正常运行
  • inactive (dead) ❌ 已停止
  • failed ❌ 启动失败

2️⃣ 启动 / 停止 / 重启 Filebeat

# 启动
systemctl start filebeat

# 停止
systemctl stop filebeat

# 重启
systemctl restart filebeat

3️⃣ 设置开机自启(可选)

systemctl enable filebeat

二、查看 Filebeat 进程是否存在

ps -ef | grep filebeat

或:

pgrep -a filebeat

如果只看到 grep filebeat,说明 Filebeat 未运行


三、查看 Filebeat 日志(排查问题很重要)

方法 1:通过 journalctl(systemd)

journalctl -u filebeat -f

方法 2:查看 Filebeat 日志文件(如有配置)

tail -f /var/log/filebeat/filebeat

或:

ls /var/log/filebeat/

四、使用 Filebeat 自带命令检查

1️⃣ 查看 Filebeat 配置是否正确

filebeat test config

2️⃣ 测试输出(如 Elasticsearch / Logstash)

filebeat test output

五、确认 Filebeat 是否正在采集日志

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 或日志内容贴出来,我可以帮你分析具体报错原因。

0