Problem in my Groking


(Sharon Sasporta) #1

Hi,

I have few entries in log that looks like that:

I am trying to build a grok that will fits them all, but have a problem where the string is : Exception occurred in API invocation More that, I need to try and catch the CM1-000259 which is the error code.

The grok I started to build:

\<\<%{LOGLEVEL:severity}\>\> \[%{PARTTIMESTAMP:timestamp}\] \[\[%{DATA:status}\] %{DATA:exe_thread_details}\] \[%{DATA:application}\] \[%{DATA:user}\] \(%{JAVACLASS:class}\) %{WORD:exception_error} %{JAVAMETHOD:exception_method}

More that, I have various customized grok patterns:

WEBLOGICTIMESTAMP %{MONTH} %{MONTHDAY}, %{YEAR} %{TIME} %{DL}
WEBLOGICTIMESTAMP_TZ %{MONTH} %{MONTHDAY}, %{YEAR} %{TIME} %{DL} ?%{TZ}?
DL ([P|A]M]?)
J2ES_TIMESTAMP %{YEAR}-%{MONTHNUM}-%{MONTHDAY} %{HOUR}:%{MINUTE}:%{SECOND}
TZ (?:[IPMCE][SD]T|UTC)
PARTTIMESTAMP %{MONTH} %{MONTHDAY} %{TIME}
# Java
JAVACLASS (?:[a-zA-Z$_][a-zA-Z$_0-9]*\.)*[a-zA-Z$_][a-zA-Z$_0-9]*
#Space is an allowed character to match special cases like 'Native Method' or 'Unknown Source'
JAVAFILE (?:[A-Za-z0-9_. -]+)
#Allow special <init>, <clinit> methods
JAVAMETHOD (?:(<(?:cl)?init>)|[a-zA-Z$_][a-zA-Z$_0-9]*)
#Line number is optional in special cases 'Native method' or 'Unknown source'
JAVASTACKTRACEPART %{SPACE}at %{JAVACLASS:class}\.%{JAVAMETHOD:method}\(%{JAVAFILE:file}(?::%{NUMBER:line})?\)
# Java Logs
JAVATHREAD (?:[A-Z]{2}-Processor[\d]+)
JAVALOGMESSAGE (.*)

The result I see in the grok debugger is:

{
"severity": [
[
"DEBUG"
]
],
"timestamp": [
[
"Feb 29 12:51:36"
]
],
"MONTH": [
[
"Feb"
]
],
"MONTHDAY": [
[
"29"
]
],
"TIME": [
[
"12:51:36"
]
],
"HOUR": [
[
"12"
]
],
"MINUTE": [
[
"51"
]
],
"SECOND": [
[
"36"
]
],
"status": [
[
"ACTIVE"
]
],
"exe_thread_details": [
[
"ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'"
]
],
"application": [
[
"CM"
]
],
"user": [
[
"ABPBatchUser"
]
],
"class": [
[
"BasicCustomizationProxy.logACMException"
]
],
"exception_error": [
[
"Exception"
]
],
"exception_method": [
[
"occurred"
]
]
}

Regards,
Sharon.


(Sharon Sasporta) #2

Hi,

Can someone try to help?

Regards,
Sharon.


(Sharon Sasporta) #3

I think I have something working now.


(Mark Walkom) #4

What ended up working?


(Sharon Sasporta) #5
            grok {
                  tag_on_failure => [ "BROKEN_GROK_SYSLOG", "_grokparsefailure" ]
                  break_on_match => true
                  keep_empty_captures => false
                  match => { "message" => "\<\<%{LOGLEVEL:severity}\>\>  \[%{PARTTIMESTAMP:timestamp}\] \[\[%{DATA}\] %{DATA}\] \[%{DATA:application}\] \(%{JAVACLASS}\) %{WORD}"}
                  patterns_dir => "/etc/logstash/patterns"
            }
            date {
                  match => ["timestamp" , "MMM dd HH:mm:ss"]
                  add_field => { "Status" => "Matched"}
                  #remove_field => ["timestamp"]
            }

(system) #6

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.