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!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Get the T-shirt to Prove You Survived Splunk University Bootcamp

As if Splunk University, in Las Vegas, in-person, with three days of bootcamps and labs weren’t enough, now ...

Wondering How to Build Resiliency in the Cloud?

IT leaders are choosing Splunk Cloud as an ideal cloud transformation platform to drive business resilience,  ...