在 Ubuntu 上启动 Filebeat 通常有以下几种方式,取决于你的安装方式(官方仓库 / deb 包 / 手动二进制)。
如果你是通过 apt 或 deb 包 安装的 Filebeat:
sudo systemctl start filebeat
sudo systemctl enable filebeat
sudo systemctl status filebeat
sudo systemctl stop filebeat
sudo systemctl restart filebeat
在启动前,建议先测试配置:
sudo filebeat test config
测试输出连接(如 Elasticsearch / Logstash):
sudo filebeat test output
如果你是下载的 filebeat 二进制文件:
sudo ./filebeat -e -c filebeat.yml
-e:输出到标准错误(方便调试)-c:指定配置文件后台运行(不推荐生产):
sudo nohup ./filebeat -e -c filebeat.yml > filebeat.log 2>&1 &
sudo chown root:root /etc/filebeat/filebeat.yml
sudo chmod 600 /etc/filebeat/filebeat.yml
journalctl -u filebeat -f
sudo filebeat modules enable system
sudo systemctl restart filebeat
如果你愿意,可以告诉我:
我可以帮你具体排查。