Your configuration isn't consistent with the output you say you're getting. If the grok filter indeed wasn't working, how come the timestamp is stripped away from the message field?
grok { match => {"message" => "(?<logtimestamp>%{MONTH}/%{MONTHDAY}/%{YEAR} %{TIME}) %{WORD:source},%{WORD:level},%{GREEDYDATA:message}"} }
will match that message. What are you trying to do with the mutate+add_field?
"source" => "%{source)"
You have mis-matched braces and parentheses. If we correct that, the source field already exists, so adding a second source field just forces it to be an array. Similarly for grokking a message field using a regexp that has an item called message -- message ends up as an array, which is probably not what you want.
"message" => [
[0] "May/03/2018 17:37:01 system,info,account user admin logged out from 192.168.88.1 via telnet",
[1] "account user admin logged out from 192.168.88.1 via telnet"
],
Hey Badger,
to eliminate configuration misstakes, I installed a completely new machine with the actual versions of elk-stack.
In my filter-options I only placed the grok-filter without any other options and renamed the fields:
filter {
if [type] == "MikroTik" {
grok {
match => {"test012" => "(?%{MONTH}/%{MONTHDAY}/%{YEAR} %{TIME}) %{WORD:test123},%{GREEDYDATA:test234}"}
}
}
}
So there should be no field that is already "in use" by logstash. Unfortunately I don´t even get the hoped result:
{
"tags" => [
[0] "_grokparsefailure"
],
"message" => "system,info,account user admin logged in from 192.168.88.1 via telnet",
"@version" => "1",
"type" => "MikroTik",
"host" => "192.168.88.3",
"@timestamp" => 2018-05-09T08:32:20.308Z
}
Again there is this grokparsefailure. Isn´t there any log that could explain where this error comes from?
Then I think that I understood something wrong. In my output there are standard defined variables like "@version", "host", "message", ....
The type-tag was given by logstash on the input-conf. Now I want the grok filter to seperate this field "message" into seperate fields, in my case "test123" and "test234".
What did I understand wrong?
In the grok filter you said it should match a date, followed by a word, followed by the rest of the line. But your message does not have a date, so grok is going to fail.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.