Hi,
I have the following Logstash filter, which works, but I find it anything but good, that should work better, right?
Input:
"The container group started for TEST"
if "The container group started for" in [message] {
grok {
match => { "message" => "%%{WORD:w1}\s+%%{WORD:w2}\s+%%{WORD:w3}\s+%%{WORD:w4}\s+%%{WORD:w5}\s+%%{WORD:check}" }
}
mutate { remove_field => [ "w1", "w2", "w3", "w4", "w5" ]
}
}
Output:
check: "TEST"
The message always consists of 6 words and I have to add the last word in a "check" field.
I had already tried the following ruby filter, which didn't work:
if "The container group started for" in [message] {
ruby { code => 'event.set("check",event.get("message").split("\s+")[-1])' }
}
Does somebody has any idea?
Regards
Thorsten