Hi everybody. I've got an inputfile that contains data in the following format (one json object per line)
{id: "1", status: "Running"}
{id: "1", status: "Finished"}
I'm shipping this via Filebeat to Logstash and then push it further to Elasticsearch - essentially done like this
input {
beats { port => 5044 }
}
filter {
json {
source => "message"
}
}
output {
elasticsearch {
document_id => "%{[id]}"
}
}
The problem I've got is, that in the case that if related log entries (correlated by id) are written just after each other (which happens all the time), then sometimes the "Finished" entry seem to overtake the "Running" one.
I'm quite puzzled and already did the following analysis:
-) Looked at the filebeat logs and it seems that filebeat sends lines in the correct order
-) Replaced elasticsearch output through stdout and everything looks like to be in order
-) !! added stdout output additionally to elasticsearch and - voila! - messages are shown in stdout in the wrong order
In reality, my logstash configuration adds some more filters and a few conditionals as well as some other inputs not related to the affected messages.
If I can't rely on the order of incoming messages, how do I solve such a problem ?
Thanks!
Peter