在Debian上配置Filebeat以支持多个输出,您需要编辑Filebeat配置文件filebeat.yml
。以下是一个示例配置,展示了如何将日志发送到两个不同的Elasticsearch集群:
filebeat.inputs: - type: log enabled: true paths: - /var/log/*.log # Elasticsearch 1st cluster output.elasticsearch: hosts: ["es-cluster-1-host1:9200", "es-cluster-1-host2:9200"] index: "filebeat-%{[agent.version]}-%{+yyyy.MM.dd}" # Elasticsearch 2nd cluster output.elasticsearch2: hosts: ["es-cluster-2-host1:9200", "es-cluster-2-host2:9200"] index: "filebeat-%{[agent.version]}-%{+yyyy.MM.dd}"
在这个示例中,我们定义了两个不同的输出模块:output.elasticsearch
和output.elasticsearch2
。每个模块都有自己的Elasticsearch集群地址列表和索引名称。
请注意,您需要根据您的实际需求修改Elasticsearch集群地址和索引名称。此外,您还可以根据需要添加更多的输出模块。
在完成配置后,保存filebeat.yml
文件并重新启动Filebeat服务以使更改生效:
sudo systemctl restart filebeat
现在,Filebeat将同时向两个Elasticsearch集群发送日志。