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!

Technical Workshop Series: Splunk Data Management and SPL2 | Register here!

Hey, Splunk Community! Ready to take your data management skills to the next level? Join us for a 3-part ...

Spotting Financial Fraud in the Haystack: A Guide to Behavioral Analytics with Splunk

In today's digital financial ecosystem, security teams face an unprecedented challenge. The sheer volume of ...

Solve Problems Faster with New, Smarter AI and Integrations in Splunk Observability

Solve Problems Faster with New, Smarter AI and Integrations in Splunk Observability As businesses scale ...