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!

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...