在 Debian 系统中,Filebeat 的开机自启方式取决于 systemd 是否可用(现代 Debian 默认使用 systemd)。
which filebeat
# 或
filebeat version
sudo systemctl enable filebeat
sudo systemctl start filebeat
sudo systemctl status filebeat
✅ 如果看到 enabled 和 active (running),说明已开机自启成功。
Elastic 官方 .deb 包会自动:
filebeat.service你只需要执行:
sudo systemctl enable filebeat
sudo systemctl start filebeat
如果你是 非常老的 Debian(如 7 及以前):
sudo update-rc.d filebeat defaults
sudo service filebeat start
如果启动失败,可手动测试:
sudo filebeat -e -c /etc/filebeat/filebeat.yml
常见错误:
sudo reboot
重启后检查:
systemctl status filebeat
如果你愿意,可以告诉我:
cat /etc/os-release)我可以给你更精确的建议。