在CentOS上定制Filebeat报告,可通过修改其配置文件/etc/filebeat/filebeat.yml
实现,具体步骤如下:
sudo yum install -y https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-7.14.0-x86_64.rpm
进行安装。sudo cp /etc/filebeat/filebeat.yml /etc/filebeat/filebeat.yml.bak
。sudo vi /etc/filebeat/filebeat.yml
打开文件进行编辑。output
部分,可配置将日志发送到Elasticsearch、Logstash等,如output.elasticsearch: hosts: ["localhost:9200"]
。filebeat.inputs
部分,指定要监控的日志文件路径,如- type: log enabled: true paths: - /var/log/*.log
。processors
部分添加自定义处理器,如add_fields
添加自定义字段,dissect
或grok
解析和过滤日志等。sudo systemctl restart filebeat
重启服务使配置生效。sudo journalctl -u filebeat -f
来验证配置是否正确。