Filebeat与Elasticsearch的联调是一个相对简单的过程,以下是详细的步骤和配置说明:
/etc/filebeat/filebeat.yml。output.elasticsearch 部分,并进行如下配置:output.elasticsearch:
hosts: ["localhost:9200"] # 替换为你的Elasticsearch地址和端口
index: "filebeat-%{[agent.version]}-%{yyyy.MM.dd}" # 日志索引名称
filebeat.inputs:
- type: log
enabled: true
paths:
- /var/log/*.log # 替换为你想要监控的日志路径
sudo systemctl start filebeat
http://your_elasticsearch_host:5601),然后检查是否有新的索引被创建。curl -X GET "localhost:9200/_cat/indices?v"
filebeat.yml 中的参数,如 harvester_buffer_size、filebeat.spool_size、filebeat.idle_timeout 等,以提高写入Elasticsearch的性能。通过以上步骤,你已经成功地将Filebeat与Elasticsearch集成,并且可以通过Kibana来可视化和分析日志数据。如果有任何问题,请参考Elastic官方文档或社区支持。