下載filebeat安裝包
訪問(wèn)Elastic官方網(wǎng)站,找到適用于Ubuntu18.04的filebeat安裝包??梢允褂脀get命令下載:
wget https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-7.10.0-amd64.deb
安裝filebeat
使用dpkg命令安裝下載的.deb包:
sudo dpkg -i filebeat-7.10.0-amd64.deb
配置filebeat
安裝完成后,編輯filebeat的配置文件:
sudo nano /etc/filebeat/filebeat.yml
在配置文件中,設(shè)置要收集的日志文件路徑和輸出目標(biāo)(如Elasticsearch或Logstash)。
啟動(dòng)filebeat服務(wù)
配置完成后,啟動(dòng)filebeat服務(wù):
sudo systemctl start filebeat
設(shè)置filebeat開(kāi)機(jī)自啟:
sudo systemctl enable filebeat
驗(yàn)證filebeat運(yùn)行狀態(tài)
檢查filebeat服務(wù)狀態(tài):
sudo systemctl status filebeat
如果看到"active (running)",說(shuō)明filebeat已成功啟動(dòng)。
troubleshooting
如遇到問(wèn)題,查看filebeat日志:
sudo journalctl -u filebeat
根據(jù)日志信息排查配置或權(quán)限問(wèn)題。
結(jié)語(yǔ)
完成以上步驟后,filebeat將在Ubuntu18.04系統(tǒng)上正常運(yùn)行,收集指定的日志文件并發(fā)送到配置的輸出目標(biāo)。定期檢查filebeat狀態(tài)和日志,確保日志收集工作持續(xù)有效進(jìn)行。