Splunk Search

How to use rex to remove "domain\' from a username?

pil321
Communicator

I have a field that looks like this:

UserName=domain\joe_user

I want it to look like this:

UserName=joe_user

How do I take out domain\ using rex?

0 Karma
1 Solution

somesoni2
Revered Legend

Try this

your base search | rex field=UserName "\w+\\(?<UserName>.*)"

OR

your base search | eval UserName=mvindex(split(UserName,"\\"),-1)

View solution in original post

Dev_Choudhary
Path Finder

try this

rex field=cs_userdn "\w+\\(?\S+)"

0 Karma

woodcock
Esteemed Legend

Like this:

... | rex field=UserName mode=sed "s/[^\\\]*\\\//"
0 Karma

somesoni2
Revered Legend

Try this

your base search | rex field=UserName "\w+\\(?<UserName>.*)"

OR

your base search | eval UserName=mvindex(split(UserName,"\\"),-1)
Get Updates on the Splunk Community!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...