Filebeat与Elasticsearch的配合使用主要通过Filebeat收集日志数据并将其转发到Elasticsearch进行存储和分析。以下是详细的步骤和配置说明:
/etc/filebeat/filebeat.yml。
filebeat.inputs:
- type: log
  enabled: true
  paths:
    - /var/log/*.log
output.elasticsearch:
  hosts: ["localhost:9200"]
  index: "filebeat-%{+yyyy.MM.dd}"
sudo systemctl start filebeat
sudo systemctl enable filebeat
filebeat.exe -e -c filebeat.yml
http://localhost:9200 访问。/var/log/filebeat/filebeat.log,以确认日志是否成功发送到Elasticsearch。filebeat.yml 中的参数,如 harvester_buffer_size、filebeat.spool_size、filebeat.idle_timeout 等,以提高写入Elasticsearch的性能。通过以上步骤,你可以成功地将Filebeat与Elasticsearch集成,实现日志的收集、传输和分析。如果有任何问题,请参考Elastic官方文档或社区支持。