We have a Logstash agent that writes its internal logs to a file in fixed format (a message written in a single row, here it's formatetd for readability):
{
:timestamp => "2015-08-20T18:24:07.458000+0300",
:message => "SIGINT received. Shutting down the pipeline.",
:level => :warn
}
I have to make rsyslog read the file, get logs with :level => :error
and send it somewhere. I used imfile module for it, here is the configuration:
module(load="imfile")
input(type="imfile"
file="/path/to/log_file"
tag="logstash:"
statefile="/path/to/state_file"
severity="error"
ruleset="logstash_internal")
ruleset(name="logstash_internal"){
# Some action goes here
...
}
How can I select only error records from log file, not all?