# Logstash RabbitMQ input plugin - How to define multiple routing\_key

**URL:** <https://discuss.elastic.co/t/logstash-rabbitmq-input-plugin-how-to-define-multiple-routing-key/183817>\
**Category:** Logstash\
**Created:** [June 1, 2019, 8:25am UTC](https://discuss.elastic.co/t/logstash-rabbitmq-input-plugin-how-to-define-multiple-routing-key/183817 "2019-06-01T08:25:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ahmad\_Ahmadi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ahmad_ahmadi/32/13590_2.png) [@Ahmad\_Ahmadi](https://discuss.elastic.co/u/Ahmad_Ahmadi)\
**Post date:** [June 1, 2019, 8:25am UTC](https://discuss.elastic.co/t/logstash-rabbitmq-input-plugin-how-to-define-multiple-routing-key/183817/1 "2019-06-01T08:25:27Z")

</div>

I'm using RabbitMQ plugin of Logstash to pull from RabbitMQ and push to Elasticsearch using this pipeline:

```auto
input {
    rabbitmq {
        queue => "Elasticsearch_Queue"
        host => "rabbitmq"
        exchange => "my_event_bus"
        key => "SomeIntegrationEvent" # How to define multiple keys?
    }
}
output {
    elasticsearch {
        hosts => ["elasticsearch:9200"]
    }
    stdout { codec => rubydebug }
}

```

It works fine and creates a queue named `Elasticsearch_Queue` and binds to `my_event_bus` exchange using routing\_key `SomeIntegrationEvent` .

I need to **subscribe to multiple events** but there is no clear solution on the [plugin docs](https://www.elastic.co/guide/en/logstash/current/plugins-inputs-rabbitmq.html#plugins-inputs-rabbitmq-key).

---

<div class="post-metadata">

**Author:** ![pastechecker](https://avatars.discourse-cdn.com/v4/letter/p/0ea827/32.png) [@pastechecker](https://discuss.elastic.co/u/pastechecker)\
**Post date:** [June 3, 2019, 6:38am UTC](https://discuss.elastic.co/t/logstash-rabbitmq-input-plugin-how-to-define-multiple-routing-key/183817/2 "2019-06-03T06:38:23Z")

</div>

The value key is a string and you cannot use the syntax like ["key1","key2"]  
Try the following way:

```
input {
    rabbitmq {
        queue => "Elasticsearch_Queue"
        host => "rabbitmq"
        exchange => "my_event_bus"
        key => "SomeIntegrationEvent1" 
    }
    rabbitmq {
        queue => "Elasticsearch_Queue"
        host => "rabbitmq"
        exchange => "my_event_bus"
        key => "SomeIntegrationEvent2" 
    }
}
```

---

<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:** [July 1, 2019, 6:40am UTC](https://discuss.elastic.co/t/logstash-rabbitmq-input-plugin-how-to-define-multiple-routing-key/183817/3 "2019-07-01T06:40:29Z")

</div>

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