Splunk Search

Using multiple REGEX in a single search

shrirangphadke
Path Finder

Hi,

I want to use multiple REGEX in OR condition in a single search. For Ex:

REGEX 1: "VDL2PortPropSet.* : Failure" OR 
REGEX 2: "Vpxa.*Copied"  OR 
REGEX 3: "opswitch.+ Failed to find netstack 'opswitch'"

How can I achieve this? Sorry if my question is repeated.
Please help.

Tags (2)
1 Solution

rkent
Explorer

You should be able to just put this in a single regex using the regex OR operator:

"VDL2PortPropSet.* : Failure|Vpxa.*Copied|opswitch.+ Failed to find netstack 'opswitch'"

I'll test this when I get to a system, but in the meantime give this a shot

View solution in original post

martin_mueller
SplunkTrust
SplunkTrust

For these simple examples you might even be fine without regex at all to speed up the search:

index=foo sourcetype=bar ("VDL2PortPropSet* : Failure" OR "Vpxa*Copied"  OR "opswitch* Failed to find netstack 'opswitch'") | rest of the search pipeline
0 Karma

shrirangphadke
Path Finder

Okey, that kind of search didn't work for me! Strange

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

Wildcard searches have been part of Splunk since forever.

0 Karma

shrirangphadke
Path Finder

Hi martin_mueller,

Thanks for your answer. This kind of search did not work for me. Is it supported from Splunk version 6.2.1? I am using 6.1.8

0 Karma

rkent
Explorer

You should be able to just put this in a single regex using the regex OR operator:

"VDL2PortPropSet.* : Failure|Vpxa.*Copied|opswitch.+ Failed to find netstack 'opswitch'"

I'll test this when I get to a system, but in the meantime give this a shot

shrirangphadke
Path Finder

It worked ! Thank you very much

0 Karma

rkent
Explorer

You're absolutely welcome

0 Karma
Get Updates on the Splunk Community!

Upcoming Webinar: Unmasking Insider Threats with Slunk Enterprise Security’s UEBA

Join us on Wed, Dec 10. at 10AM PST / 1PM EST for a live webinar and demo with Splunk experts! Discover how ...

.conf25 technical session recap of Observability for Gen AI: Monitoring LLM ...

If you’re unfamiliar, .conf is Splunk’s premier event where the Splunk community, customers, partners, and ...

A Season of Skills: New Splunk Courses to Light Up Your Learning Journey

There’s something special about this time of year—maybe it’s the glow of the holidays, maybe it’s the ...