Splunk Search

extract string to a field

navd
New Member

I have some strings appearing in the events , i want to extract them ,it doesnt have any keyvalue pair
sample event :-
6/15/18
4:53:00.123 PM 420420 1529074380797 2018-06-15 14:53:00.797 10.224.34 - - - - prod abc.services ffffffffdcfb607e-186-16403ef6ffd000 ERROR ERROR - - - - com.data.driver.core.exceptions.NouserAvailableException: All user(s) tried for query failed

so from the above event I would want to extract "com.data.driver.core.exceptions.NouserAvailableException"

Tags (1)
0 Karma

vinod94
Contributor

if the events are of the same type, you can try this...

| makeresults 
| eval data="6/15/18
4:53:00.123 PM 420420 1529074380797 2018-06-15 14:53:00.797 10.224.34 - - - - prod abc.services ffffffffdcfb607e-186-16403ef6ffd000 ERROR ERROR - - - - com.data.driver.core.exceptions.NouserAvailableException: All user(s) tried for query failed" 
| rename data as _raw 
| rex field=_raw "ERROR\s\-\s\-\s\-\s\-(?P<field_name>[^\:]+)"

lloydknight
Builder

Hello @navd

You may refer to this link to access the field extractor,
Or you can extract fields using regex. See link.

Also, if the provided sample event is in uniform with the succeeding events, try this query:

your base search | rex "\ERROR ERROR - - - - (?<Exception>.*)\:"

Hope it helps!

0 Karma

Ayn
Legend

What other data around it can you rely on to stay the same? Are the dashes before your text static for instance? Did you try the interactive field extractor?

0 Karma
Get Updates on the Splunk Community!

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 ...

Index This | Forward, I’m heavy; backward, I’m not. What am I?

April 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...