# RabbitMQ between provider and consumer

**URL:** <https://discuss.elastic.co/t/rabbitmq-between-provider-and-consumer/116709>\
**Category:** Logstash\
**Created:** [January 23, 2018, 4:21pm UTC](https://discuss.elastic.co/t/rabbitmq-between-provider-and-consumer/116709 "2018-01-23T16:21:55Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andrzej\_Rosiek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrzej_rosiek/32/26850_2.png) [@Andrzej\_Rosiek](https://discuss.elastic.co/u/Andrzej_Rosiek)\
**Post date:** [January 23, 2018, 4:21pm UTC](https://discuss.elastic.co/t/rabbitmq-between-provider-and-consumer/116709/1 "2018-01-23T16:21:56Z")

</div>

Hi, I have configuration like:

nginx \> logstash \> rabbitmq \> logstash \> file

provider output config:

```
output {
    rabbitmq {
        id => "nginx"
        host => "rabbitmq"
        exchange => "nginx"
        exchange_type => "direct"
    }
}

```

consumer config:

```
input {
    rabbitmq {
        host => "rabbitmq"
        subscription_retry_interval_seconds => 5
    }
}

output {
    file {
        codec => rubydebug
        path => "/var/log/logstash/nginx-rabbitmq-logs-%{+YYYY-MM-dd}.log"
    }
}

```

provider works fine, I am able to get message in rabbitmq manager. but I am not sure why message is not passed to consumer. any ideas?

regards  
Andrzej

---

<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:** [January 23, 2018, 9:39pm UTC](https://discuss.elastic.co/t/rabbitmq-between-provider-and-consumer/116709/2 "2018-01-23T21:39:21Z")

</div>

But you haven't configured the consumer. How would it know to start consuming from the nginx messages?

---

<div class="post-metadata">

**Author:** ![Andrzej\_Rosiek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrzej_rosiek/32/26850_2.png) [@Andrzej\_Rosiek](https://discuss.elastic.co/u/Andrzej_Rosiek)\
**Post date:** [January 25, 2018, 1:42pm UTC](https://discuss.elastic.co/t/rabbitmq-between-provider-and-consumer/116709/3 "2018-01-25T13:42:44Z")

</div>

what do you mean? I provided my customer config. is there something wrong with that? what kind of configuration did you mean? I am sorry I not much familiar with logstash. I just would like to figure it out.

---

<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:** [January 25, 2018, 9:32pm UTC](https://discuss.elastic.co/t/rabbitmq-between-provider-and-consumer/116709/4 "2018-01-25T21:32:12Z")

</div>

You've configured your rabbitmq output to send events to the nginx exchange, but you're not configuring your rabbitmq input in any way except the hostname. How would that plugin know what to listen for?

---

<div class="post-metadata">

**Author:** ![Andrzej\_Rosiek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrzej_rosiek/32/26850_2.png) [@Andrzej\_Rosiek](https://discuss.elastic.co/u/Andrzej_Rosiek)\
**Post date:** [January 25, 2018, 9:50pm UTC](https://discuss.elastic.co/t/rabbitmq-between-provider-and-consumer/116709/5 "2018-01-25T21:50:42Z")

</div>

Hi, thanks for the answear. as I mentioned I am using 2 containers with logstash:

- provider
- consumer

provider sends data to rabbitmq from nginx (via syslogs) - this part works well. I am able to get events in rabbitmq manager. I didn't put input for the provider because I think it is not imporant. am I right?

if you need provider input:

```
input {
  syslog {
    host => 'logstash-provider'
    port => 5140
  }
}

output {
    rabbitmq {
        id => "nginx"
        host => "rabbitmq"
        exchange => "nginx"
        exchange_type => "direct"
    }
}

```

and once again consumer:

```
input {
    rabbitmq {
        host => "rabbitmq"
        subscription_retry_interval_seconds => 5
    }
}

output {
    file {
        codec => rubydebug
        path => "/var/log/logstash/nginx-rabbitmq-logs-%{+YYYY-MM-dd}.log"
    }
}

```

consumer should get info from rabbitmq and put data to the file. as you may notice consumer has input and output config provided.

---

<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:** [January 26, 2018, 2:48pm UTC](https://discuss.elastic.co/t/rabbitmq-between-provider-and-consumer/116709/6 "2018-01-26T14:48:37Z")

</div>

> consumer should get info from rabbitmq

Yes, **but which RabbitMQ messages should it subscribe to**? You'll have to use some combination of the `exchange`, `queue`, `exchange_type`, and `key` options. I've never used the direct exchange type so I'm not sure exactly how it works.

---

<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:** [February 23, 2018, 2:48pm UTC](https://discuss.elastic.co/t/rabbitmq-between-provider-and-consumer/116709/7 "2018-02-23T14:48:53Z")

</div>

Closed on February 23, 2018, 2:48pm UTC

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