# Rabbitmq input metadata

**URL:** <https://discuss.elastic.co/t/rabbitmq-input-metadata/101348>\
**Category:** Logstash\
**Created:** [September 21, 2017, 1:56pm UTC](https://discuss.elastic.co/t/rabbitmq-input-metadata/101348 "2017-09-21T13:56:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Charlotte\_EGM](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/charlotte_egm/32/13503_2.png) [@Charlotte\_EGM](https://discuss.elastic.co/u/Charlotte_EGM)\
**Post date:** [September 21, 2017, 1:56pm UTC](https://discuss.elastic.co/t/rabbitmq-input-metadata/101348/1 "2017-09-21T13:56:29Z")

</div>

Hi,

I would like to see the metadata of my rabbitmq input.

I have set metadata\_enabled to true

and then i added this :

```
add_field => { "topic" => "%{[@metadata][rabbitmq_properties][routing-key]}"}

```

Unfortunately I end up with a string field "topic" = %{[@metadata][rabbitmq\_properties][routing-key]}

How can I retrieve the information ?

Thanks

---

<div class="post-metadata">

**Author:** ![Charlotte\_EGM](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/charlotte_egm/32/13503_2.png) [@Charlotte\_EGM](https://discuss.elastic.co/u/Charlotte_EGM)\
**Post date:** [September 22, 2017, 9:44am UTC](https://discuss.elastic.co/t/rabbitmq-input-metadata/101348/2 "2017-09-22T09:44:30Z")

</div>

I have tested the configuration with rubydebug, and there is no metadata in the output. I guess the problem come from this.

Here is my config

```
input {
  rabbitmq {
    host => "x.x.x.x"
    subscription_retry_interval_seconds => 5
    exchange => "amq.topic"
    key => "#"
    auto_delete => "true"
    user => "x"
    password => "x"
    metadata_enabled => "true"
    #add_field => { "topic" => "%{[@metadata][rabbitmq_properties][routing-key]}"}
    }
}

filter {

  split {
           field => "metrics"
           terminator => "},"
  }
  mutate {
           rename => {"[metrics][dataType]" => "metrics_datatype"}
           rename => {"[metrics][name]" => "metrics_name"}
           rename => {"[metrics][timestamp]" => "metrics_timestamp"}
           rename => {"[metrics][value]" => "metrics_value"}
  }

  if [metrics_datatype] == "float" {
    ruby {
           code => 'event.set(event.get("metrics_name") + "_value", event.get("metrics_value").to_f)'
    }
  }

}

output {
   stdout {codec => rubydebug {metadata => true}}
}

```

here is the output (no metadata)

```
 "@timestamp" => 2017-09-22T09:42:50.840Z,
        "metrics_value" => "7.5",
     "metrics_datatype" => "float",
             "@version" => "1",
         "metrics_name" => "PH",
              "metrics" => {},
    "metrics_timestamp" => "2017-09-22T09:42:50.821Z",
             "PH_value" => 7.5,
            "timestamp" => "2017-09-22T09:42:50.821Z",
                 "tags" => []
```

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [September 22, 2017, 11:16am UTC](https://discuss.elastic.co/t/rabbitmq-input-metadata/101348/3 "2017-09-22T11:16:50Z")

</div>

Which version of Logstash and which version of the rabbitmq input plugin?

---

<div class="post-metadata">

**Author:** ![Charlotte\_EGM](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/charlotte_egm/32/13503_2.png) [@Charlotte\_EGM](https://discuss.elastic.co/u/Charlotte_EGM)\
**Post date:** [September 22, 2017, 11:19am UTC](https://discuss.elastic.co/t/rabbitmq-input-metadata/101348/4 "2017-09-22T11:19:26Z")

</div>

Hi,

I just figured out the problem.

I had to use "plain" codec in the input section.

Then the metadata are here.

I used a json filter after that to read the message in the filter section.

WIth json codec or if no codec is set, metadata don't appear.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 20, 2017, 11:19am UTC](https://discuss.elastic.co/t/rabbitmq-input-metadata/101348/5 "2017-10-20T11:19:31Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
