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

Labels (1)
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
Get Updates on the Splunk Community!

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...

Introducing Splunk Enterprise 9.2

WATCH HERE! Watch this Tech Talk to learn about the latest features and enhancements shipped in the new Splunk ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...