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!

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...