在 Debian 系统上启动 Filebeat 通常有以下几种方式,取决于你是通过 APT 包安装 还是 二进制/压缩包安装。
如果你是用如下方式安装的:
sudo apt install filebeat
sudo systemctl start filebeat
sudo systemctl enable filebeat
sudo systemctl status filebeat
sudo systemctl stop filebeat
sudo systemctl restart filebeat
适合临时测试或排错:
sudo filebeat -e -c /etc/filebeat/filebeat.yml
参数说明:
-e:输出日志到终端-c:指定配置文件路径⚠️ 这种方式不会以服务方式运行,关闭终端即停止。
如果你下载的是:
filebeat-8.x.x-linux-x86_64.tar.gz
cd filebeat-8.x.x-linux-x86_64
sudo ./filebeat -e -c filebeat.yml
如需作为服务运行,需要手动写 systemd 服务文件。
sudo filebeat test config
sudo filebeat test output
/etc/filebeat/filebeat.yml
如果你遇到 启动失败 / 无日志 / 连不上 ES,可以把 systemctl status filebeat 或日志贴出来,我可以帮你具体分析。