Splunk Search

Need help with this REGEX that uses AND and OR

echojacques
Builder

I have a nullQueue setup in my transforms.conf and this regex works perfectly to drop all "service=53" OR "dst=10.10.10.10" events from getting indexed:

REGEX=(service=53|dst=10.10.10.10)

Now, I need to modify it so that it continues to drop all service=53 events but for dst=10.10.10.10, it only drops service=80 OR service=5000 events and keeps the rest. In other words, I need the regex to match this:

  1. drop all (service=53) events
  2. drop events when (dst=10.10.10.10 AND service=80) OR drop when (dst=10.10.10.10 AND service=5000).

To do this, I tried this regex and it didn't work:

REGEX=((service=53|(?=dst=10.10.10.10)(?=service=80|service=5000)))

I'm new to regex and any help would be great. Thanks.

Tags (1)
0 Karma
1 Solution

Ayn
Legend

Assuming dst comes before service in the events:

service=53|dst=10.10.10.10.+?(service=80|service=5000)

View solution in original post

Ayn
Legend

Assuming dst comes before service in the events:

service=53|dst=10.10.10.10.+?(service=80|service=5000)

echojacques
Builder

It works, thank you!!

0 Karma

echojacques
Builder

Thanks and yes, dst comes before service. I'll test it this afternoon.

0 Karma
Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

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