在CentOS系统集成Filebeat可参考以下步骤:
- 安装Filebeat:可通过
wget命令从Elastic官方网站下载适用于CentOS的Filebeat软件包,如wget https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-7.14.0-x86_64.rpm,然后使用sudo rpm -vi filebeat-7.14.0-x86_64.rpm进行安装。 - 配置Filebeat:编辑
/etc/filebeat/filebeat.yml文件,指定要监控的日志文件路径,如filebeat.inputs: - type: log enabled: true paths: - /var/log/*.log,并配置输出到Elasticsearch的地址和端口,如output.elasticsearch: hosts: - "localhost:9200"。 - 启动Filebeat:使用
sudo systemctl start filebeat命令启动服务,并通过sudo systemctl enable filebeat设置为开机自启动。 - 验证部署:查看
/var/log/filebeat/filebeat.log日志文件,确认Filebeat是否正常运行,也可登录Kibana查看日志数据是否成功发送。