Logsash RabbitMQ

input{
        rabbitmq {
                host => "192.168.1.200"
                #连接本地的rabbitmq可以不用设置user和password 默认guest 远程则需要另外创建一个用户
                user => "admin"              
                password => "admin" 
                ######################    
                queue => "topic_log_error"
                durable => true
                codec => "plain"
                type => "error"
        }
        rabbitmq {
                host => "192.168.1.200"
                #与上同
                user => "admin"
                password => "admin"
                queue => "topic_log_info"
                codec => "plain"
                durable => true
                type => "info"
        }

}
filter {
        if ([message]== "")
        {
            drop {}
        }
}

output {
        if [type] == "error" {
                elasticsearch {
                        hosts => [ "192.168.1.200:9200"]
                        index => "logstash-error"
                }
        }
        if [type] == "info" {
                elasticsearch {
                        hosts => [ "192.168.1.200:9200"]
                        index => "logstash-info"
                }
        }
        stdout{
                codec => rubydebug
         }
}

你可能感兴趣的:(Logsash RabbitMQ)