Rabbitmq as logstash input


(Daniel Dziubecki) #1

Im trying to read logs from rabbitmq queue from logstash and then pass it to elasticsearch. But with no success. Here is my logstash config.

input {
    rabbitmq {
        host => "localhost"
        port => 15672
        heartbeat => 30
        durable => true
        exchange => "logging_queue"
        exchange_type => "logging_queue"
    }
}
output {
    elasticsearch {
        hosts => "localhost:9200"
    }
    stdout {}
}

RabbitMQ panel

But there is no index created so ofcourse I cant see any logs in Kibana


(Magnus Bäck) #2

Comment out the elasticsearch output and use a stdout { codec => rubydebug } output when debugging.

Your screen dump shows the logging_queue exchange, not a queue. You should make sure to name your queue so that it won't be disappear when Logstash disconnects. The documentation of the plugin's queue option is unfortunately broken and contains lots of irrelevant stuff (I'll send a PR), but here's the important part:

The name of the queue Logstash will consume events from. If left empty, a transient queue with an randomly chosen name will be created.

So are any messages being published and routed to the queue? Is Logstash trying to consume from the queue? Are there any clues in the Logstash logs?


(Daniel Dziubecki) #3

Okay, Ive made some fixes.

input {
    rabbitmq {
      host => "localhost"
      queue => "logging_queue"
      durable => true
   }
}
output {
   stdout { codec => rubydebug }
}

I have 7 messages in my queue

But It still does'nt work and there is nothing special in logs

[2017-08-03T20:15:20,666][INFO ][logstash.runner ] Using config.test_and_exit mode. Config Validation Result: OK. Exiting Logstash
[2017-08-03T20:15:48,140][INFO ][logstash.runner ] Using config.test_and_exit mode. Config Validation Result: OK. Exiting Logstash
[2017-08-03T20:16:58,204][INFO ][logstash.runner ] Using config.test_and_exit mode. Config Validation Result: OK. Exiting Logstash
[2017-08-03T20:20:14,080][INFO ][logstash.runner ] Using config.test_and_exit mode. Config Validation Result: OK. Exiting Logstash
[2017-08-03T20:37:39,264][INFO ][logstash.runner ] Using config.test_and_exit mode. Config Validation Result: OK. Exiting Logstash


(Magnus Bäck) #4

[2017-08-03T20:37:39,264][INFO ][logstash.runner ] Using config.test_and_exit mode. Config Validation Result: OK. Exiting Logstash

And if you actually start Logstash instead of just running it in test-configuration-and-exit-mode?


(Daniel Dziubecki) #5

Okay. I was running wrong file. Just logstash.bat instead of logstash ... that was stupid :slight_smile: Thanks Magnus


(system) #6

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