Splunk Search

Multiple Values per Event - transforms.conf regex

lohans
Explorer

I am trying to pick out all the Email addresses from the sample data below:

USER:Peter Pan
EMAIL:email@email.com
EMAIL:email1@email.com
EMAIL:email2@email.com
EMAIL:email3@email.com
EMAIL:email4@email.com
EMAIL:email5@email.com
USER:Bob Scott
EMAIL:email@email.com
EMAIL:email1@email.com
EMAIL:email2@email.com
EMAIL:email3@email.com
EMAIL:email4@email.com
EMAIL:email5@email.com
USER:Tomas Uncle
EMAIL:email@email.com
EMAIL:email1@email.com
EMAIL:email2@email.com
EMAIL:email3@email.com
EMAIL:email4@email.com
EMAIL:email5@email.com

Now this regex with rex works fine and picks up all the email addresses

rex field=_raw max_match=15 "EMAIL:(?<test>.*?)\n"

But how do i specify in transforms.conf to match multiple times??

There is no max_match option for transforms.conf
Here is my transforms.conf

[get-emails]
REGEX = ^EMAIL:(.*?)\n
FORMAT = Emails::$1

As you can see i tried both types of supported regex's in the transforms.conf file.

Any ideas?

1 Solution

ziegfried
Influencer

You can use the MV_ADD option in your transforms stanza:

[get-emails]
REGEX = EMAIL:(\S+)
FORMAT = Emails::$1
MV_ADD = true

View solution in original post

ziegfried
Influencer

You can use the MV_ADD option in your transforms stanza:

[get-emails]
REGEX = EMAIL:(\S+)
FORMAT = Emails::$1
MV_ADD = true

lohans
Explorer

Now that was easy! Thanks a million! 😉

0 Karma
Get Updates on the Splunk Community!

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...

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 ...