Grok patterns with ( { [ . , \ /


(Farhad Yousefi) #1

Hi . I want to catch my exception with ELK but my exception is full of ( { [ . , \ / , " ' character. How can I index them in grok .
thank you

my log file:

Exception in *** CoreLevel*** occured. 
Date&Time: 2018-01-21 09:52:20.744092 
Root: 
 ( ['MQROOT' : 0x7f0a902b2d80]
  (0x01000000:Name  ):Properties = ( ['MQPROPERTYPARSER' : 0x7f0a902bffa0]
    (0x03000000:NameValue):MessageFormat          = 'jms_text' (CHARACTER)  )
    (0x03000000:NameValue):MsgId            = X'5059414d313339363131303234383030303238' (BLOB))
    (0x01000000:Name     ):usr            = (
      (0x03000000:NameValue):MessageName = 'SampleMessageName' (CHARACTER)
      (0x03000000:NameValue):MsgVersion  = 'V1' (CHARACTER)
    )
  )
) 
***************************************************************************************** 
***************************************************************************************** 
ExceptionList:  
( ['MQROOT' : 0x7f0a9072b350]
  (0x01000000:Name):RecoverableException = (
    (0x03000000:NameValue):File                 = '/build/slot1/S800_P/src/DataFlowEngine/PluginInterface/ImbJniNode.cpp' (CHARACTER)
    (0x03000000:NameValue):Line                 = 1260 (INTEGER)
    (0x03000000:NameValue):Text                 = 'Caught exception and rethrowing' (CHARACTER)
    (0x01000000:Name     ):Insert               = (
      (0x03000000:NameValue):Type = 14 (INTEGER)
    )
          (0x03000000:NameValue):Label    = '' (CHARACTER)
          (0x03000000:NameValue):Catalog  = "BIPmsgs" (CHARACTER)
          (0x03000000:NameValue):Severity = 3 (INTEGER)
          (0x03000000:NameValue):Number   = 4395 (INTEGER)
   )
  )
)

and I except to get this pattern into kibana

Exception in: CoreLevel, 
Date&Time: 2018-01-21 09:52:20.744092
message:{
  Root:".....",
  ExceptionList:"......"
}

and this is my grok block that doesn't work

 grok {
    patterns_dir => "/etc/logstash/patterns/"
    break_on_match => false
    keep_empty_captures => true
    
    match => {"message" => ["Exception in (?<msg_f> occured..) Date&Time: %{SYSLOGTIMESTAMP:timestamp}"]}
 }

  mutate {
        gsub => ["message", "\n", ""]
 }

I really appropriate if anyone can help me. thank you


(Vladimir Smorodinov) #2

Hi Farhad,

Just look into multiline grok | regular expressions carefully.

P.S. some questions just should go to freelance.
V.


(system) #3

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