在Debian上定制Filebeat报告,可通过修改其配置文件/etc/filebeat/filebeat.yml实现,具体步骤如下:
sudo apt update和sudo apt install filebeat进行安装。/etc/filebeat/filebeat.yml,可使用sudo cp /etc/filebeat/filebeat.yml /etc/filebeat/filebeat.yml.bak命令备份。nano或vim)打开配置文件,如sudo nano /etc/filebeat/filebeat.yml。filebeat.inputs部分,指定要监控的日志文件路径,如- type: log enabled: true paths: - /var/log/*.log。output部分,选择输出目标,如发送到Elasticsearch可配置output.elasticsearch: hosts: ["localhost:9200"]。processors部分,可添加如add_fields等处理器来处理日志数据,例如processors: - add_fields: target: "" fields: type: "myapp"。logging.level设置,如logging.level: info。nano,按Ctrl+O保存,Ctrl+X退出;若用vim,按Esc键,输入:wq并回车。sudo systemctl restart filebeat使配置生效。sudo journalctl -u filebeat -f查看日志,确认配置是否正确。