在Debian系統上定制Filebeat報告,可通過編輯其配置文件/etc/filebeat/filebeat.yml實現,具體步驟如下:
sudo apt update和sudo apt install filebeat進行安裝。sudo cp /etc/filebeat/filebeat.yml /etc/filebeat/filebeat.yml.bak。nano或vim)打開配置文件,例如sudo nano /etc/filebeat/filebeat.yml。filebeat.inputs部分,指定要監控的日志文件路徑,如paths: - /var/log/*.log。output部分,配置日志發送目標,如發送到Elasticsearch可寫output.elasticsearch: hosts: ["localhost:9200"]。processors部分,添加如add_fields等處理器來處理日志數據,例如processors: - add_fields: fields: custom_field: "custom_value"。logging.level、文件忽略時間ignore_older等。sudo systemctl restart filebeat。sudo journalctl -u filebeat -f,確認配置是否正確。