Splunk Search

How to extract numbers from multivalue fields

cindygibbs_08
Communicator

Hello Guys I have a sort of quick question that has been challanging me.

 

I use this SPL to extract some info

 

 

| stats values(*) as * by CLIENTE_OUTPOST

 

 

Sometimes I use list sometimes I use values... and I want to be able to extract all values in the multivalue field "PROMOS" in a new field called "ADDED" this is an example:

 

from this:

 

CLIENT_OUTPOSTPROMOSDATEVOUCHER
LIZZA_90UIK_IO
87585
A_IDYD
78545
10584
18-05-2021XX-PO-89

 

I want this:

CLIENT_OUTPOSTPROMOSDATEVOUCHERADDED
LIZZA_90UIK_IO
87585
A_IDYD
78545
10584
18-05-2021XX-PO-8987585
78545
10584



I will be so thankfull if you can help me out, just for reference I will eaither have strings with characters or strings that are numbers... but i have tried mvfilter, rex without any luck thank you so much guys!

 

Love,

 

Cindy

Labels (1)
0 Karma
1 Solution

venkatasri
SplunkTrust
SplunkTrust

Hi @cindygibbs_08 can you try this?

<your_search>
| eval promos_delim=mvjoin(PROMOS,",")
| rex field=promos_delim max_match=0 "(?<Added>\d+)" 
| table PROMOS Added 

---

An upvote would be appreciated and Accept solution if this reply helps!

View solution in original post

venkatasri
SplunkTrust
SplunkTrust

Hi @cindygibbs_08 can you try this?

<your_search>
| eval promos_delim=mvjoin(PROMOS,",")
| rex field=promos_delim max_match=0 "(?<Added>\d+)" 
| table PROMOS Added 

---

An upvote would be appreciated and Accept solution if this reply helps!

cindygibbs_08
Communicator

@venkatasri  the best! 10/10 sorry for the delay 

0 Karma
Get Updates on the Splunk Community!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...