I have Logstash v2.3 with the following configuration:
> input {
> beats {
> port => 5044
> }
> }
> filter {
> grok {
> match => ["message", "(?m)[%{HTTPDATE:msg_timestamp}] [%{LOGLEVEL:log_level}] %{GREEDYDATA:log_message}"]
> }
> date {
> match => ["msg_timestamp", "dd/MMM/YYYY:HH:mm:ss Z"]
> target => "@timestamp"
> }
> }
> output {
> elasticsearch {
> ...
> }
Moreover, I have the multiline pattern enabled in filebeat as:
pattern: ^[
negate: true
match: after
As log_message I'm expecting to have any kind of character in possibly multilines. So messages, as the following, should match but grok is failing:
[26/Oct/2016:10:10:29 +0200] [DEBUG] Preparing/etc
However in http://grokdebug.herokuapp.com/ everything works perfectly. What should I change? Is there any known problem/bug with greedydata? What should I use instead?
Ups, I didn't realise that it was escaped, it's like the following:
(?m)\[%{HTTPDATE:msg_timestamp}\] \[%{LOGLEVEL:log_level}\] %{GREEDYDATA:log_message}
I seem to have a problem with the escaping character. I have detected that messages like "XXXX /etc" work without any problem but other messages like "XXX/etc" do not. Please, note the space after the "/". What do you think could be the issue? Why is it that sometimes the "/" presents problems and sometimes it doesn't? I give an example below:
I don't see any issue and the line you provided works in grokdebuger. Greedydata takes everything
maybe the tag is getting set on a different filter? try add_tag_on_falure => ["ANYTHING"] to this grok statement just to see if it still has a grok failure
If it does the "failure is coming from something else. otherwise if you can post your config
That's the problem, there is no problem with the pattern match (also working in http://grokdebug.herokuapp.com/ ) but it's not running properly when there is a escape character. I have no other filter as I have posted in my configuration, so the problem is just coming from the grok:
input {
beats {
port => 5044
}
}
filter {
grok {
match => ["message", "(?m)\[%{HTTPDATE:msg_timestamp}\] \[%{LOGLEVEL:log_level}\] %{GREEDYDATA:log_message}"]
}
date {
match => ["msg_timestamp", "dd/MMM/YYYY:HH:mm:ss Z"]
target => "@timestamp"
}
}
output {
elasticsearch {
...
}
Is there anything that I should set? Anything I should be aware?
But that is not exactly what Magnus provided. You syntax is wrong. Either copy the entire filter configuration from the example (not just the expression) or have a look in the documentation to see how a match clause should be constructed.
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.