Logstash RabbitMQ Input Plugin not recognize host and port

Hello Guys!

I'm trying to use Logstash to receive messages from RabbitMQ but it not recognize my configuration, cosidering only localhost:5672 and failing when tries to connect.

I have already tested the connection with RabbitMQ several times and with many applications, and all works fine.

I'm using Docker to run Logstash, installing RabbitMQ Input Plugin before running Logstash

docker-compose (only logstash part)

  logstash:
    image: docker.elastic.co/logstash/logstash:7.3.1
    container_name: logstash
    environment:
      - NODE_NAME=my-logstash
      - PATH_CONFIG=/usr/share/logstash/my-confs
    volumes:
      - ./logstash/conf:/usr/share/logstash/my-confs
    command: bash -c "bin/logstash-plugin install logstash-input-rabbitmq && logstash -f /usr/share/logstash/my-confs"
    links:
      - elasticsearch
    depends_on:
      - elasticsearch

my conf (only input part)

input 
{
    rabbitmq
    {
        host => "rabbit.mydomain.com"
        port => 5005
        vhost => "my-vhost"
        user => "user"
        password => "pass"
        queue => "my-queue"
        exchange => "my-exchange"
        exchange_type => "direct"
        durable => true
        automatic_recovery => true
        connect_retry_interval => 10 
        prefetch_count => 10
    }
}

Running with debug mode enabled, I can see (showing right configuration)

logstash         | [2019-09-04T15:29:05,950][DEBUG][logstash.inputs.rabbitmq ] config LogStash::Inputs::RabbitMQ/@connect_retry_interval = 10
logstash         | [2019-09-04T15:29:05,951][DEBUG][logstash.inputs.rabbitmq ] config LogStash::Inputs::RabbitMQ/@heartbeat = 30
logstash         | [2019-09-04T15:29:05,953][DEBUG][logstash.inputs.rabbitmq ] config LogStash::Inputs::RabbitMQ/@automatic_recovery = true
logstash         | [2019-09-04T15:29:05,954][DEBUG][logstash.inputs.rabbitmq ] config LogStash::Inputs::RabbitMQ/@exchange_type = "direct"
logstash         | [2019-09-04T15:29:05,956][DEBUG][logstash.inputs.rabbitmq ] config LogStash::Inputs::RabbitMQ/@vhost = "elk"
logstash         | [2019-09-04T15:29:05,957][DEBUG][logstash.inputs.rabbitmq ] config LogStash::Inputs::RabbitMQ/@durable = true
logstash         | [2019-09-04T15:29:05,959][DEBUG][logstash.inputs.rabbitmq ] config LogStash::Inputs::RabbitMQ/@port = 5005
logstash         | [2019-09-04T15:29:05,960][DEBUG][logstash.inputs.rabbitmq ] config LogStash::Inputs::RabbitMQ/@host = ["rabbit.mydomain.com"]
logstash         | [2019-09-04T15:29:05,964][DEBUG][logstash.inputs.rabbitmq ] config LogStash::Inputs::RabbitMQ/@queue = "my-queue"
logstash         | [2019-09-04T15:29:05,961][DEBUG][logstash.inputs.rabbitmq ] config LogStash::Inputs::RabbitMQ/@exchange = "my-exchange"
logstash         | [2019-09-04T15:29:05,963][DEBUG][logstash.inputs.rabbitmq ] config LogStash::Inputs::RabbitMQ/@user = "user"
logstash         | [2019-09-04T15:29:05,958][DEBUG][logstash.inputs.rabbitmq ] config LogStash::Inputs::RabbitMQ/@password = <password>
logstash         | [2019-09-04T15:29:05,959][DEBUG][logstash.inputs.rabbitmq ] config LogStash::Inputs::RabbitMQ/@prefetch_count = 10
logstash         | [2019-09-04T15:29:05,964][DEBUG][logstash.inputs.rabbitmq ] config LogStash::Inputs::RabbitMQ/@enable_metric = true
logstash         | [2019-09-04T15:29:05,970][DEBUG][logstash.inputs.rabbitmq ] config LogStash::Inputs::RabbitMQ/@threads = 1
logstash         | [2019-09-04T15:29:05,973][DEBUG][logstash.inputs.rabbitmq ] config LogStash::Inputs::RabbitMQ/@passive = false
logstash         | [2019-09-04T15:29:05,975][DEBUG][logstash.inputs.rabbitmq ] config LogStash::Inputs::RabbitMQ/@arguments = {}
logstash         | [2019-09-04T15:29:05,976][DEBUG][logstash.inputs.rabbitmq ] config LogStash::Inputs::RabbitMQ/@auto_delete = false
logstash         | [2019-09-04T15:29:05,976][DEBUG][logstash.inputs.rabbitmq ] config LogStash::Inputs::RabbitMQ/@exclusive = false
logstash         | [2019-09-04T15:29:05,977][DEBUG][logstash.inputs.rabbitmq ] config LogStash::Inputs::RabbitMQ/@ack = true
logstash         | [2019-09-04T15:29:05,978][DEBUG][logstash.inputs.rabbitmq ] config LogStash::Inputs::RabbitMQ/@key = "logstash"
logstash         | [2019-09-04T15:29:05,979][DEBUG][logstash.inputs.rabbitmq ] config LogStash::Inputs::RabbitMQ/@subscription_retry_interval_seconds = 5
logstash         | [2019-09-04T15:29:05,980][DEBUG][logstash.inputs.rabbitmq ] config LogStash::Inputs::RabbitMQ/@metadata_enabled = false

ERROR in Logstash (see that localhost:5672 is displayed in this line)

logstash         | [2019-09-04T15:24:34,724][ERROR][logstash.inputs.rabbitmq ] RabbitMQ connection error, will retry. {:error_message=>"Connection to localhost:5672 refused", :exception=>"MarchHare::ConnectionRefused"}

But I need connect to rabbit.mydomain.com:5005, like my configuration.

Can someone help me? :pray:

Thx!!

This is a known issue. According to that you can work around it by using

host => "rabbit.mydomain.com:5005"

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