在CentOS上使用Filebeat插件,一般可按以下步骤进行:
可从Elastic官网下载对应版本的安装包,使用rpm命令安装,如curl -L -O https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-7.10.0-x86_64.rpm,然后sudo rpm -vi filebeat-7.10.0-x86_64.rpm。
编辑/etc/filebeat/filebeat.yml文件。若使用内置插件,如输入插件log、filestream、systemd等,可参考中示例配置,例如filebeat.inputs: - type: log enabled: true paths: - /var/log/*.log。若使用自定义插件,需将插件文件放到指定目录,一般在/usr/share/filebeat/modules.d/或/etc/filebeat/modules.d/,然后在配置文件中启用,如./filebeat modules enable nginx来启用Nginx模块。
配置完成后,使用sudo systemctl start filebeat启动服务,sudo systemctl status filebeat查看状态。可通过查看日志文件或对应输出目标(如Elasticsearch、Logstash)来验证插件是否正常工作。