Dashboards & Visualizations

New column using regex

yifatcy
Path Finder

Hi,

I have the field Queue in my dataset with pattern as follows:

adcams01

adcams02

adcems05

I would like to create a new column in my table which contains 3 letters after adc. For example:

Queue:Site
adcams01ams
adcams02ams
adcems05ems

Is it possible using regex? I know it should include eval but it didn't work for me.

Thank you

0 Karma
1 Solution

kamlesh_vaghela
SplunkTrust
SplunkTrust

@yifatcy 

Try

YOUR_SEARCH
 | rex field=Queue "adc(?<Site>.{3})"

 

Sample Search:

| makeresults | eval _raw="Queue
adcams01
adcams02
adcems05" | multikv forceheader=1 | table Queue | rex field=Queue "adc(?<Site>.{3})"

 

Thanks
Kamlesh Vaghela 

If this reply helps you, an upvote would be appreciated.

 

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust
| rex field=Queue "adc(?<Site>[^\d]+)"

kamlesh_vaghela
SplunkTrust
SplunkTrust

@yifatcy 

Try

YOUR_SEARCH
 | rex field=Queue "adc(?<Site>.{3})"

 

Sample Search:

| makeresults | eval _raw="Queue
adcams01
adcams02
adcems05" | multikv forceheader=1 | table Queue | rex field=Queue "adc(?<Site>.{3})"

 

Thanks
Kamlesh Vaghela 

If this reply helps you, an upvote would be appreciated.

 

yifatcy
Path Finder

Works! thanks

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Data Persistence in the OpenTelemetry Collector

This blog post is part of an ongoing series on OpenTelemetry. What happens if the OpenTelemetry collector ...

Introducing Splunk 10.0: Smarter, Faster, and More Powerful Than Ever

Now On Demand Whether you're managing complex deployments or looking to future-proof your data ...

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...