首页 > 其他 > 详细

多个Filebeat输入到Logstash设置不同的索引

时间:2020-06-11 21:43:17      阅读:146      评论:0      收藏:0      [点我收藏+]

需求

对每一台机器上都装一个filebeat,然后都指向同一个logstash,这时不同的filebeat传输的数据过来,需要输出到不同的索引,

 

技术分享图片

 

办法

在filebeat的配置文件里添加fields.service: nginx(可自定义)
 
filebeat.prospectors:
- type: log  
  enabled: true

  paths:
    - /var/log/nginx-json/access.log

  input_type: log
  fields.document_type: nginx
  fields.service: nginx
  tags: ["nginx"]

filebeat.config.modules:
 
  path: ${path.config}/modules.d/*.yml

  reload.enabled: false

output.logstash:
    hosts: ["10.0.0.5:5044"]

 

在Logstash的配置文件里: 添加if [fields][service] == "nginx"{...}
 
output {
  if [fields][service] == "nginx"{
    elasticsearch {
       hosts => ["http://localhost:9200"]
       index => "h5-nginx-%{+YYYY.MM.dd}"
    }
  }
}

 

多个Filebeat输入到Logstash设置不同的索引

原文:https://www.cnblogs.com/lemon-le/p/13096166.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!