在Debian上部署Filebeat的流程如下:
更新系統:確保你的Debian系統已經更新到最新版本。
sudo apt update && sudo apt upgrade -y
下載Filebeat安裝包:訪問Elastic官方網站,下載適用于Debian系統的Filebeat安裝包(通常為.deb
文件)。
wget https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-7.15.0-amd64.deb
dpkg
命令安裝下載的.deb
文件。sudo dpkg -i filebeat-7.15.0-amd64.deb
apt-get
命令自動安裝缺失的依賴包。sudo apt-get install -f
/etc/filebeat/filebeat.yml
。你可以根據需要修改配置,例如指定日志文件路徑、Elasticsearch的地址和端口等。filebeat.inputs:
- type: log
enabled: true
paths:
- /var/log/*.log
output.elasticsearch:
hosts:
- "localhost:9200"
sudo systemctl start filebeat
sudo systemctl enable filebeat
sudo systemctl status filebeat
sudo tail -f /var/log/filebeat/filebeat.log
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 elasticsearch
sudo apt-get install kibana
http://your_kibana_host:5601
,然后按照以下步驟配置索引模式:
filebeat-*
)并點擊“Next step”。@timestamp
)并點擊“Create index pattern”。通過以上步驟,你就可以在Debian上成功部署和配置Filebeat,以監控日志并將其發送到Elasticsearch進行存儲和分析。