logstash-plugins / logstash-input-rabbitmq

Apache License 2.0
30 stars 43 forks source link

Retrieving Metadata-Fields do not work #79

Closed julian-eggers closed 8 years ago

julian-eggers commented 8 years ago

Hey,

I want to split the routing-key of a rabbit-message to 3 different new fields but I am not able to get the routing-key at all.

My Setup: logstash 2.3 rabbitmq-plugin 4.0.1 rabbitmq 3.6.1

My current config:

input
{
        rabbitmq
        {
                host => "localhost"
                user => "logstash"
                password => "sbusf767673"
                exchange => "net.logstash.logs"
                key => "#"
                queue => "net.logstash.logs.application"
                durable => true
                metadata_enabled => true
        }
}

filter
{
                mutate
                {
                        add_field => {"routingkey" => [@metadata][rabbitmq_properties][routing-key]}
                }
}

output
{
        file
        {
                path => "/tmp/logs.txt"
        }
}

I tried several options to read the routing-key but I always get an config-error.

julian-eggers commented 8 years ago

Works with logstash 2.3.1 and add_field => {"routing-key" => "%{[@metadata][rabbitmq_properties][routing-key]}"}