在CentOS中,Filebeat用于日志收集的步骤如下:
安装Filebeat:
yum install -y filebeat
配置Filebeat:
filebeat.yml
,通常位于/etc/filebeat/filebeat.yml
。配置文件中需要指定日志文件的位置和Elasticsearch的输出目标:filebeat.inputs:
- type: log
paths:
- /var/log/*.log
output.elasticsearch:
hosts: ["elasticsearch:9200"]
启动Filebeat:
systemctl start filebeat
systemctl enable filebeat
验证配置:
systemctl status filebeat
通过以上步骤,Filebeat将会收集指定日志文件的数据并发送到Elasticsearch中进行进一步处理和分析。