在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,确认配置是否正确。