在Debian上部署Filebeat的步骤如下:
wget https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-8.15.2-linux-x86_64.tar.gz
tar -zxvf filebeat-8.15.2-linux-x86_64.tar.gz
sudo mv filebeat-8.15.2-linux-x86_64 /usr/local/filebeat-8.15.2
sudo mkdir -p /data/filebeat_data/{conf,data,tmp}
sudo mkdir -p /data/logs/filebeat
sudo cp /usr/local/filebeat-8.15.2/filebeat.yml /data/filebeat_data/conf/
sudo vi /data/filebeat_data/conf/filebeat.yml
filebeat.inputs:
- type: log
enabled: true
paths:
- /var/log/*.log
output.elasticsearch:
hosts: ["localhost:9200"]
setup.ilm.enabled: false
sudo /usr/local/filebeat-8.15.2/filebeat -c /data/filebeat_data/conf/filebeat.yml -d "publish"
sudo tee /etc/systemd/system/filebeat.service <<EOF
[Unit]
Description=Filebeat sends log files to Logstash or directly to Elasticsearch.
Documentation=https://www.elastic.co/products/beats/filebeat
Wants=network-online.target
After=network-online.target
[Service]
WorkingDirectory=/usr/local/filebeat-8.15.2
Environment="BEAT_CONFIG_OPTS=-c /data/filebeat_data/conf/filebeat.yml"
Environment="BEAT_PATH_OPTS=-path.home /usr/local/filebeat-8.15.2 -path.config /data/filebeat_data/conf -path.data /data/filebeat_data/data -path.logs /var/log/filebeat"
ExecStart=/usr/local/filebeat-8.15.2/filebeat \( -c /data/filebeat_data/conf/filebeat.yml \)
Restart=always
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl enable filebeat
sudo systemctl start filebeat
sudo systemctl status filebeat
/var/log/filebeat/filebeat.log
)以排查问题。以上步骤应该可以帮助你在Debian系统上成功部署Filebeat。如果在部署过程中遇到任何问题,请参考Filebeat的官方文档或联系Elastic支持获取帮助。