Splunk Search

how to extract from java.lang

GreeshmaV
New Member

My events look like this
TYP=ERR, TS1=1423574799157, TS2=1423574799157, CMP=PUR, EDESC=Unknown Host
java.lang.Exception: Validation failed: input param is NULL
LogClient.java:39)

How to extract from java.lang.Exception to the end of the event using regular expression

Tags (2)
0 Karma

thomrs
Communicator

Off the top of my head something like this

(?i)java.lang.Exception:\s?<field>(.+)$
0 Karma

cpetterborg
SplunkTrust
SplunkTrust

This works for my data (YMMV) at search time:

"java.lang.Exception" | rex field=_raw "(?ms)java.lang.Exception(?P<exception>.+)"
0 Karma

thomrs
Communicator

add (?ms) on the beginning - the s is dotall, and the m is multi-line.

 (?ms)java.lang.Exception:\s?<field>(.+)
0 Karma

GreeshmaV
New Member

its multiline event

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Is that the entire event? I ask because of the mis-matched paren. Is it a single-line or multi-line event?

---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...

Splunk APM: New Product Features + Community Office Hours Recap!

Howdy Splunk Community! Over the past few months, we’ve had a lot going on in the world of Splunk Application ...