We're currently taking messages from RabbitMQ using logstash and outputting them to Elasticsearch. We noticed some scenarios of 400 responses and have enabled Logstash dead letter to ensure messages are not lost.
We have a further input on the dead letter and output these messages back to RabbitMQ into a Dead Letter Exchange there. This makes it easy for us to replay the messages back should we figure out why we had the 400 and would have fixed it.
What we noticed is that the headers in the rabbitmq message originally sent were being dropped when they get to the output queue of rabbitmq after it passes through the dead letter system.
Is this something we are missing or is this expected behaviour?
That's expected. Headers are optionally added as fields to the event by the rabbitmq input but if you want to preserve them when they're sent to the dead letter queue that's up to you, but if you don't want the headers indexed in ES I doubt there's a way for you to get exactly what you want.
Thanks for your reply! My question would be, how do you preserve them into dead letter? And if they are preserved in dead letter, can they be sent back to rabbit via the rabbit output plugin?
Thanks. We're trying the following to preserve the index name as a separate field so that if it does end up in dead letter, we can replay the message back into the original rabbitmq queue:
The name of the field is target_index, so either drop [fields] or update the add_field stanza to actually save the x-target-index header in the [fields][target_index] field.
To clarify, using [@metadata][rabbitmq_headers][x-target-index] directly for the index name in the output works, but it defeats the purpose of wanting to store the index name as a field in the first place.
Does the dead letter for Logstash preserve which index name the document should have gone to when it gave the 400/404 error so long as the error is not related to the index name itself?
If that's the case, perhaps we can work around all of this using a separate pipeline, with its own rabbitmq input on a different queue where messages can be moved to manually after any fixes are done. The pipeline would take the index name directly from those messages that are sent back to rabbitmq from the dead letter in the first place perhaps?
Does the dead letter for Logstash preserve which index name the document should have gone to when it gave the 400/404 error so long as the error is not related to the index name itself?
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.