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!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...