I have been receiveing a _grokparsefailure tag in Logstash but cannot find the issue. My Logstash Grok filter looks like this:
grok {
match => { "message" => "%{TIMESTAMP_ISO8601:timestamp}%{GREEDYDATA:input}" }
}
I have no idea what the issue is. My log contains an ISO8601 timestamp "2016-09-28T09:44:22,533-0700 data-blah blah \r" and a carriage return character at the end that is not visible. Should'nt GREEDYDATA pickup the carriage return symbol as well? I have also tried using my timestamp with a space intead of T "2016-09-28 09:44:22,533-0700" but I get the same issue. The space between the timestamp and GREDDYDATA exist, which is why a have a space after my timestamp in my grok filter. Thanks in advance guys, chromehris.
Are you sure you don't have any other grok filters laying around in your configuration files? Remember that Logstash reads all files in /etc/logstash/conf.d. As I showed in a previous example the grok filter does work and does not add a _grokparsefailure tag. It seems you're either not showing us all of your configuration or you're not using the configuration you think you are. Replicating my example could be a good start.
I indeed am using multiple config files under /conf.d, one is an output and the others are input-&-filter each . My configuration however passes the configtest. How can multiple configuration files affect a _grokparsefailure tag in a certain message that comes from a config file which does not create such a tag? Since I most certainly know that my configuration file that I have originally mentioned should not cause a _grokparsefailure. I have tries different filters and I still receive this _grokparsefailure, so this tag must be coming from another source.
That basically just means it's syntactically correct. Whether it does what you expect it to is a very different matter.
How can multiple configuration files affect a _grokparsefailure tag in a certain message that comes from a config file which does not create such a tag?
Another file could contain a grok filter that isn't under a condition, meaning it applies to all events.
file A:
filter {
grok {
match => ["message", "this pattern doesn't match anything"]
}
}
file B:
filter {
if [type] == "sometype" {
grok {
match => ["message", "this pattern matches my log file"]
}
}
}
In this example, every single event will get the _grokparsefailure tag since the grok filter in file A will apply to all events but will match none of them.
This should be okay, but keep in mind that add_field appends to any existing values so you'll probably end up with a type field that's a two-element array. Prefer the mutate filter's replace option.
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.