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

Try like this

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

What’s New in Splunk Cloud Platform 9.1.2308?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2308! Analysts can ...

Index This | Why do they call it hyper text?

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

State of Splunk Careers 2023: Career Resilience and the Continued Value of Splunk

For the past three years, Splunk has partnered with Enterprise Strategy Group to conduct a survey that gauges ...