Hi all,
I'm fairly new to ELK and I suspect this is an easy question for someone who knows ES well.
I am building a CI acceptance test pipeline in Serverspec to validate my Puppet ELK builds. The most important test of all for me is to prove that a message sent from logger to the /var/log/messages file finds its way through the shipper->redis->indexer pipeline and can be found via the ES search API within a reasonable time.
Unfortunately the messages are sometimes taking up to 15 minutes to appear.
My Serverspec code is:
describe 'end to end test' do
it 'a message sent by logger is found in ES search' do
shell 'logger -f /var/log/messages glueball'
sleep 120
shell "curl -XPOST 'localhost:9200/logstash-*/_refresh'" # see below for others I tried here
shell "curl 'localhost:9200/logstash-*/_search?pretty' -d '{\"query\":{\"match\":{\"message\":\"glueball\"}}}'" do |r|
expect(r.stdout).to match /glueball/
end
end
end
I have tried various commands (most out of desperation) to force ES to be updated immediately but nothing seems to cause the message to instantly appear:
8 curl -XPOST 'localhost:9200/logstash-*/_refresh'
9 curl -XPOST 'localhost:9200/logstash-*/_flush'
10 curl -XPOST 'localhost:9200/logstash-*/_flush?wait_if_ongoing'
11 curl -XPOST 'localhost:9200/logstash-*/_flush?force'
Strangely, one thing that does seem to work is to send a second message via logger. The first message usually appears within a few seconds after that, as if it somehow dislodges the most recent message that is "stuck"!
Any help most appreciated.