I am a new to Logstash and I want to store nginx messages in RabbitMQ queue like this:
Nginx logs -(input)-> Logstash -(output)-> RabbitMQ
logstash config:
filter {
grok {
match => { "message" => "%{IPORHOST:remote_ip} - %{DATA:user_name} \[%{HTTPDATE:access_time}\] \"%{WORD:http_method} %{DATA:url} HTTP/%{NUMBER:http_version}\" %{NUMBER:response_code} %{NUMBER:body_sent_bytes} \"%{DATA:referrer}\" \"%{DATA:agent}\"" }
}
}
output {
rabbitmq {
exchange => "nginx_app"
host => "localhost"
exchange_type => "topic"
persistent => true
passive => true
heartbeat => 10
arguments => {"x-ha-policy" => "all" }
codec => "plain"
port => 5672
}
}
During debugging in RabbitMQ web console I see the following: message are visible to RabbitMQ but it doesn't save them in the queue in the same time when I use simple python script to add message to the queue everthing is saved), enter image description here
what's wrong with my config? Why RabbitMQ doesn't save messages?
Thank you in advance!
I found the root cause of my issue, I needed to add a binding to my queue, after adding the binding, every message logged correctly. enter image description here