ELK redis配置logstash

input {
   
     file {
        path => "/srv/web/a/logs/a.*"
        start_position => "beginning"
        type => "a"
          
     }

      file {
        path => "/srv/web/b/logs/b.*"
        start_position => "beginning"
        type => "b"
          
     }

     redis {

    host => "120.70.35.123"

    port => "6379"

    data_type => "list"

    type => "c"

    key => "c:redis"

    password => "c"

     }
     redis {

     host => "120.70.35.123"

    port => "6379"

    data_type => "list"

    key => "d:redis"

    type => "d"

    password => "d"

       }

redis {

      host => "120.70.35.123"

    port => "6379"

    data_type => "list"

    key => "e:redis"

    type => "e"

    password => "redis123"

}

redis {

      host => "120.70.35.123"

    port => "6379"

    data_type => "list"

    key => "f:redis"

    type => "f"

    password => "f"

}

redis {

     host => "120.70.35.123"

    port => "6379"

    data_type => "list"

    key => "g:redis"

    type => "g"

    password => "g"

}
}
output {
    if "_grokparsefailure" in [tags] {
    }else{

      if [type] == "a"{
                elasticsearch {
                         hosts => ["http://localhost:9200"]
                         index => "a-%{+YYYY.MM.dd}"
                }
       }

          if [type] == "b"{
                elasticsearch {
                         hosts => ["http://localhost:9200"]
                         index => "b-%{+YYYY.MM.dd}"
                }
       }


        if [type] == "c"{
                elasticsearch {
                         hosts => ["http://localhost:9200"]
                         index => "c-%{+YYYY.MM.dd}"
                }
       }
   
    
         if [type] == "d"{
                elasticsearch {
                         hosts => ["http://localhost:9200"]
                         index => "d-%{+YYYY.MM.dd}"
                }
       }
         if [type] == "f"{
                elasticsearch {
                         hosts => ["http://localhost:9200"]
                         index => "f-%{+YYYY.MM.dd}"
                }
       }
       
  if [type] == "g"{
                elasticsearch {
                         hosts => ["http://localhost:9200"]
                         index => "g-%{+YYYY.MM.dd}"
                }
       }

      

    }  
}

猜你喜欢

转载自ljz0898.iteye.com/blog/2404772
今日推荐