Dashboard query
-
patalenszki.zoltan
- Posts: 40
- Joined: Tue Sep 13, 2016 9:16 am
Dashboard query
Dear All,
I would like to create a query on Dashboard for pattern <128>* but it seem that it ignores angle brackets.
So message <134> Oct 20 18:23:03 HOST.DOMAIN /LM/W3SVC/1/ROOT/MobilSign.Interface.NN.Wcf-4-131214475152949404: [Interface.NN.ACC] [128] [] [CallId: ] [NotifyDocument] [signDoc... also matches with query.
I tries to supress with escape character( \) but with no succes.
Could you pleae help me?
Thanks in advance!
regards,
Zoltan Patalenszki
I would like to create a query on Dashboard for pattern <128>* but it seem that it ignores angle brackets.
So message <134> Oct 20 18:23:03 HOST.DOMAIN /LM/W3SVC/1/ROOT/MobilSign.Interface.NN.Wcf-4-131214475152949404: [Interface.NN.ACC] [128] [] [CallId: ] [NotifyDocument] [signDoc... also matches with query.
I tries to supress with escape character( \) but with no succes.
Could you pleae help me?
Thanks in advance!
regards,
Zoltan Patalenszki
Re: Dashboard query
So the issue is that we would like to capture messages like the one highlighted in red and exclude the other matching messages:
The problem is with how elasticsearch is storing the "message" field internally. Without getting too technical, it's basically breaking down the message field into individual bits and often excludes special characters in it's tokenization of the "message" field. So elasticsearch really only sees "128" when the original event contains "<128>".
What we can do to mitigate this is plug the value between those brackets <128> into it's own field and query that field specifically. I wrote this very simply filter to accomplish this:
Which will target the import_raw event type, find a number between the <> characters, and store it in the "special_number" field like so:
Now if I revise my query to target the special_number field specifically, special_number:128, I get the following results:
Which has eliminated the entries with [128] effectively.
The problem is with how elasticsearch is storing the "message" field internally. Without getting too technical, it's basically breaking down the message field into individual bits and often excludes special characters in it's tokenization of the "message" field. So elasticsearch really only sees "128" when the original event contains "<128>".
What we can do to mitigate this is plug the value between those brackets <128> into it's own field and query that field specifically. I wrote this very simply filter to accomplish this:
Code: Select all
if [type] == 'import_raw' {
grok {
match => [ 'message', '\<%{NUMBER:special_number}\>' ]
}
}
Now if I revise my query to target the special_number field specifically, special_number:128, I get the following results:
Which has eliminated the entries with [128] effectively.
You do not have the required permissions to view the files attached to this post.
Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/
-
patalenszki.zoltan
- Posts: 40
- Joined: Tue Sep 13, 2016 9:16 am
Re: Dashboard query
Sorry, but i'm newbie in Nagios environment.
Should i add the new filter on Administration/Global confoguration page?
I did that, but don't find the new field after that.
Thanks in advance!
regards,
Zoltan
Should i add the new filter on Administration/Global confoguration page?
I did that, but don't find the new field after that.
Thanks in advance!
regards,
Zoltan
Re: Dashboard query
Can you share a screenshot of one of the messages fully expanded like so:
The filter may need to be revised to match your specific message/environment. I used if [type] == 'import_raw' as the conditional because I was testing on the import_raw input type.
The filter may need to be revised to match your specific message/environment. I used if [type] == 'import_raw' as the conditional because I was testing on the import_raw input type.
You do not have the required permissions to view the files attached to this post.
Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/
-
patalenszki.zoltan
- Posts: 40
- Joined: Tue Sep 13, 2016 9:16 am
Re: Dashboard query
I modified type to syslog when i tried your suggestion.
I already have a syslog filter. I tried to modify(replace the first pattern in match) it and to create a new, additional one as well.
Please find here the filter already exists in our nagios environment.
Thanks in advance!
I already have a syslog filter. I tried to modify(replace the first pattern in match) it and to create a new, additional one as well.
Please find here the filter already exists in our nagios environment.
Code: Select all
if [type] == "syslog" and "%ASA-" not in [message] and "localhost" not in [host] {
grok {
match => [ "message", "<%{POSINT:syslog_pri}>%{SYSLOGTIMESTAMP:syslog_timestamp} %{SYSLOGHOST:syslog_hostname} %{DATA:syslog_program}(?:\[%{POSINT:syslog_pid}\])?: %{GREEDYDATA:syslog_message}" ]
}
}You do not have the required permissions to view the files attached to this post.
Re: Dashboard query
This site is your very best friend when creating grok filters:
http://grokdebug.herokuapp.com/
In the top box you put your sample message, and in the bottom box your grok filter rules:
You will see your field matches in the results box underneath.
Here's the filter pattern i've used to deconstruct this data completely:
Use that in the grok debugger linked above and rename field1, field2, ... field6 to more appropriate names for your use case.
http://grokdebug.herokuapp.com/
In the top box you put your sample message, and in the bottom box your grok filter rules:
You will see your field matches in the results box underneath.
Here's the filter pattern i've used to deconstruct this data completely:
Code: Select all
\<%{NUMBER:special_number}\> %{SYSLOGTIMESTAMP:syslog_timestamp} %{SYSLOGHOST:syslog_hostname} /%{DATA:syslog_program}: \[%{DATA:field1}\] \[%{DATA:field2}\] \[%{DATA:field3}\] \[CallId\: %{DATA:CallId}\] \[%{DATA:field4}\] \[%{DATA:field5}\] %{GREEDYDATA:field6}You do not have the required permissions to view the files attached to this post.
Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/
-
patalenszki.zoltan
- Posts: 40
- Joined: Tue Sep 13, 2016 9:16 am
Re: Dashboard query
Thank you very much! It works.
Regards,
Zoli
Regards,
Zoli
-
avandemore
- Posts: 1597
- Joined: Tue Sep 27, 2016 4:57 pm
-
patalenszki.zoltan
- Posts: 40
- Joined: Tue Sep 13, 2016 9:16 am
Re: Dashboard query
Yes. Thank You!