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!

Detecting Remote Code Executions With the Splunk Threat Research Team

REGISTER NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If ...

Observability | Use Synthetic Monitoring for Website Metadata Verification

If you are on Splunk Observability Cloud, you may already have Synthetic Monitoringin your observability ...

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...