要使用Filebeat采集Debian系统日志,可以按照以下步骤进行配置:
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-7.x.list
sudo apt-get update
sudo apt-get install -y filebeat
/etc/filebeat/filebeat.yml
。你可以指定要监控的日志文件路径。例如,要监控Nginx的访问日志,可以添加如下配置:filebeat.prospectors:
- input_type: log
paths:
- /var/log/nginx/access.log
output.elasticsearch:
hosts: ["localhost:9200"]
index: "nginx-access-%{+YYYY.MM.dd}"
sudo systemctl start filebeat
sudo systemctl enable filebeat
--configtest
选项来测试配置文件是否正确:sudo filebeat --configtest
如果没有错误,Filebeat将输出配置测试的结果。
通过以上步骤,Filebeat将开始收集指定的Debian系统日志,并将它们发送到配置的输出目的地,如Elasticsearch。记得根据实际的日志文件路径和需求调整配置文件。