I have a logstash agent that monitors our automatic tests' log dumps -
at the beginning of each bulk of tests, an agent is started, listens to a specific folder, and at the end it should stop.
The problem is at the end - i need to somehow signal the logstash agent that the tests are done and kill itself..
How can I do that? What is the way to configure the agent so that when it sees a certain log message from the tests it kills himself?
My config file:
input {
file {
type => "cloudify-logs"
path => "<path_to_test_class_folder>/*"
tags => [ "<suite_name>" , "<test_name>" , "<build_number>" , "<version>" ]
}
}
output {
stdout { debug => true debug_format => "json"}
redis { host => "<host>" data_type => "list" key => "logstash" }
}
One option would be to put a line at the end of your log such as:
You can then create a LogStash "kill" script which is executed by LogStash when it hits that line.
For example: