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!

Introducing Splunk Enterprise 9.2

WATCH HERE! Watch this Tech Talk to learn about the latest features and enhancements shipped in the new Splunk ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...