Splunk Search

How can I extract specific text from logs?

ppanchal
Path Finder

Below is my sample log,

05:59:26,173 INFO  [LoggingAspect] (ajp-/10.248.156.65:8909-11)  User Logged : vleeladh into the method : saveFilters with Parameter : {"userId":"vleeladh","tier":"[]","marketarea":"[]","businessunit":"[]","site":"

I want to extract the userId (vleeladh) from the log.

Can someone please assist me?

0 Karma

woodcock
Esteemed Legend

Like this:

... | rex "{\"userId\":\"(?<userId>[^\",]+)"
0 Karma

somesoni2
Revered Legend

Try like this

your base search | rex "\"userid\":\"(?<userId>[^\"]+)"
Get Updates on the Splunk Community!

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

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