Splunk Search

Multiple regex expressions for 1 field name

beaunewcomb
Communicator

I have 2 different extractions but their values need to be part of the same field. How can I do that? I've tried using regex groups, using the same field name in both matches but no luck.

Tags (1)
0 Karma

lguinn2
Legend

Do it as two separate extractions:

In props.conf:

EXTRACT-e1=mq-qm(?P<object>[^)]{0,20})
EXTRACT-e2=mpgw(?P<object>[^)]{0,20})

Also, if you want to use parentheses for grouping, you need to specify a non-capturing group.

(?: )

instead of just

( )

Although that wasn't the only problem here...

0 Karma

beaunewcomb
Communicator

To be more clear- what I'm trying to do is create a field from this regex:

mq-qm((?P[^)]{0,20})|mpgw((?P[^)]{0,20})

But I get this error:
Encountered the following error while trying to save: In handler 'props-extract': Regex: two named subpatterns have the same name

0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

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