在 CentOS 上启动 Filebeat 通常有几种方式,取决于你是 通过 RPM 包安装 还是 二进制包解压使用。下面分别说明。
如果你是用官方 RPM 包安装的(最常见):
systemctl start filebeat
systemctl enable filebeat
systemctl status filebeat
systemctl stop filebeat
systemctl restart filebeat
在启动前,建议先测试配置是否正确:
filebeat test config
测试输出(可选):
filebeat test output
如果你是下载 filebeat-*.tar.gz 解压使用的:
cd /opt/filebeat
./filebeat -e -c filebeat.yml
nohup ./filebeat -e -c filebeat.yml > filebeat.log 2>&1 &
journalctl -u filebeat -f
或:
tail -f /var/log/filebeat/filebeat
/etc/filebeat/filebeat.ymlfilebeat.yml(当前目录)filebeat.inputs:
- type: log
enabled: true
paths:
- /var/log/*.log
output.elasticsearch:
hosts: ["http://localhost:9200"]
如果你能告诉我:
我可以给你更精确的启动和排错方案。