要使用Filebeat监控CentOS系统,您需要按照以下步骤进行操作:
wget https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-<版本号>-linux-x86_64.tar.gz
请将<版本号>
替换为实际的Filebeat版本号。
tar xzvf filebeat-<版本号>-linux-x86_64.tar.gz
cd filebeat-<版本号>-linux-x86_64
filebeat.yml
配置文件以指定要监控的日志文件路径或日志类型。例如:filebeat.inputs:
- type: log
enabled: true
paths:
- /var/log/*.log
output.elasticsearch:
hosts:
- "elasticsearch:9200"
这个配置指定Filebeat监控/var/log/
目录下的所有.log
文件,并将日志发送到本地的Elasticsearch实例。
./filebeat -e -c filebeat.yml
sudo systemctl enable filebeat
sudo systemctl start filebeat
sudo systemctl status filebeat
http://<Filebeat主机>:5066/stats?pretty
来查看详细的监控数据。通过以上步骤,您就可以使用Filebeat来监控CentOS系统的日志文件,并将这些日志数据发送到Elasticsearch或其他存储和分析工具中进行进一步的处理和分析。