温馨提示×

centos filebeat怎么看运行状态

小樊
45
2026-09-08 23:30:36
栏目: 智能运维

在 CentOS 上查看 Filebeat 运行状态,常用以下几种方式,取决于你是怎么安装的(systemd / 二进制直接运行)。


一、使用 systemd(最常见,yum/rpm 安装)

1️⃣ 查看运行状态

systemctl status filebeat

✅ 正常输出示例:

● filebeat.service - Filebeat sends log files to Elasticsearch or Logstash
   Loaded: loaded (/usr/lib/systemd/system/filebeat.service; enabled)
   Active: active (running) since ...

❌ 异常状态:

  • inactive (dead)
  • failed

2️⃣ 启动 / 停止 / 重启

systemctl start filebeat
systemctl stop filebeat
systemctl restart filebeat

3️⃣ 设置开机自启

systemctl enable filebeat

二、查看 Filebeat 日志

systemd 日志

journalctl -u filebeat -f

日志文件(如配置了)

tail -f /var/log/filebeat/filebeat

三、查看 Filebeat 进程

ps -ef | grep filebeat

或:

pgrep -a filebeat

四、确认是否在监听/工作(测试配置)

1️⃣ 测试配置文件

filebeat test config

2️⃣ 测试输出(ES / Logstash)

filebeat test output

五、查看 Filebeat 自身指标(可选)

如果你的 filebeat.yml 开启了 HTTP 监控:

http.enabled: true
http.port: 5066

查看:

curl http://localhost:5066/stats

六、常见异常排查

  • 起不来:看 journalctl -u filebeat
  • 没数据:检查 filebeat.ymlpathsoutput
  • 权限问题
ls -l /var/log/xxx.log

如果你愿意,可以把:

  • systemctl status filebeat 的输出
  • filebeat.yml 关键配置

贴出来,我可以帮你具体看问题。

0