My goal is:
1: Configure Logstash (version: 6.2.1) to pull events from RabbitMQ (version: 3.6.1) ( as input)
2: Depending upon the content of the event (message), store them in different files (as output)
Right now, I'm struggling to achieve my first goal. Here's my logstash config:
input {
rabbitmq {
host => "localhost"
durable => true
exchange => "RSLOG"
queue => "RSLOG"
}
}
output {
stdout { }
}
After starting logstash, the log, along with some startup messages prints this:
[2019-01-29T09:41:47,284][ERROR][logstash.inputs.rabbitmq ] RabbitMQ connection error, will retry. {:error_message=>"Connection to localhost:5672 failed: timeout", :exception=>"MarchHare::ConnectionRefused"}
I tried adding port to the configuration. But no mater what port number I add, logstash prints the same message. There no service on my local box which is listening on port 5672.
What is this port? Is this the port where rabbit listens on for admin console (15672)?
Documentation says:
This plugin uses the March Hare library for interacting with the RabbitMQ server.
Unfortunately I didn't find anywhere how to install and configure it.
After I get my goal 1 working, is it possible to achieve my goal 2?
That was the missing link. I enabled the tcp_listener at 5672. This time, logstash could not authenticate. Here's the message:
[2019-01-29T11:41:50,274][ERROR][logstash.inputs.rabbitmq ] RabbitMQ connection error, will retry. {:error_message=>"Authentication with RabbitMQ failed or RabbitMQ version used does not support AMQP 0-9-1. Username: guest, vhost: /, password length: 5. Please check your configuration.", :exception=>"MarchHare::AuthenticationFailureError"}
That should be doable using logstash. Look at the dissect and grok filters for parsing. You can use a file output and have the filename depend on the contents of the message. For example, this configuration will put one line in /tmp/foo2 and one in /tmp/foo3.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.