zoukankan      html  css  js  c++  java
  • 多个Filebeat输入到Logstash设置不同的索引

    需求

    对每一台机器上都装一个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}"
        }
      }
    }

     

  • 相关阅读:
    1043. 输出PATest(20)
    1042. 字符统计(20)
    1041. 考试座位号(15)
    1040. 有几个PAT(25)
    1035. 插入与归并(25)
    栈:火车进站
    ABC Fennec VS. Snuke
    费解的开关
    最短Hamilton路径
    built?
  • 原文地址:https://www.cnblogs.com/lemon-le/p/13096166.html
Copyright © 2011-2022 走看看