Splunk Search

How to extract the user and move it to a field in Splunk?

LearningGuy
Builder

How to extract the following user and move it to a field in Splunk?
message: xad="/home/andy"
message: xad="/home/george"
message: xad="/home/cindy"
and a lot more..
I would like to get an output as follows.    Because of the quote " before /home, Splunk rejected my regex. Please help. Thanks
user  
====    
andy
george
cindy

Labels (4)
0 Karma

yuanliu
SplunkTrust
SplunkTrust

You obviously has a field named xad.  From this, no need for rex.

| eval user = mvindex(split(xad, "/"), 1)
Tags (1)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

I think @yuanliu meant

| eval user = mvindex(split(xad, "/"), 2)

Having said that, can you share the failed rex and/or the full events (anonymised, of course) in a code block </> to preserve the format of the event?

0 Karma
Get Updates on the Splunk Community!

Get Inspired! We’ve Got Validation that Your Hard Work is Paying Off

We love our Splunk Community and want you to feel inspired by all your hard work! Eric Fusilero, our VP of ...

What's New in Splunk Enterprise 9.4: Features to Power Your Digital Resilience

Hey Splunky People! We are excited to share the latest updates in Splunk Enterprise 9.4. In this release we ...

Take Your Breath Away with Splunk Risk-Based Alerting (RBA)

WATCH NOW!The Splunk Guide to Risk-Based Alerting is here to empower your SOC like never before. Join Haylee ...