Splunk Search

How do you regex a part of a field name to use in a separate field?

barney00
New Member

I have a field which is a username, but the results of the username starts with "USR" and the actual username is "USRAjames".

I actually need to get the "A" and the "james" and put it in seperate field.

Thoughts?

0 Karma

ddrillic
Ultra Champion

A simplistic one ; - ) - USR(?<afield>A)(?<name>.*)

0 Karma

Vijeta
Influencer

you can try this

rex field=username "USR(?<fname>\w{1})\w+"| rex field=username "USR\w{1}(?<lname>\w+)"
0 Karma
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 ...