在CentOS上安装Filebeat的步骤如下:
filebeat-8.0.0-linux-x86_64.tar.gz
。tar -zxvf filebeat-8.0.0-linux-x86_64.tar.gz
cd filebeat-8.0.0-linux-x86_64
filebeat.yml
配置文件,根据你的需求进行配置。主要的配置项包括filebeat.inputs
(指定要监控的日志文件或目录)、output.elasticsearch
(指定Elasticsearch的地址和端口)等。例如:filebeat.inputs:
- type: log
enabled: true
paths:
- /var/log/*.log
output.elasticsearch:
hosts:
- "localhost:9200"
./filebeat -c filebeat.yml &
ps -a | grep filebeat
/var/log/filebeat/filebeat.log
,以确认其是否正常工作。systemctl enable filebeat
filebeat.yml
文件中添加多个filebeat.inputs
配置块,每个配置块指定一个日志目录。请注意,以上步骤是基于CentOS 7和Filebeat 8.0.0版本的示例。如果你使用的是其他版本的CentOS或Filebeat,可能需要根据具体版本进行相应的调整。此外,确保在配置Filebeat时,Elasticsearch服务已经在你的CentOS服务器上运行,并且Filebeat可以访问到它。