Getting Data In

Filtering on keywords with exceptions

nidhsha2
New Member

Hi,
I am trying to figure out if there is an easy way to filter based on a word and its negative-form.

For example, I want to filter for all data that does NOT include "dog" , BUT if there is a response with "no dog", then I want to capture that data as well.

index=data_log AND response!="*dog*"

Any ideas on this?

0 Karma
1 Solution

woodcock
Esteemed Legend

Like this:

index=data_log AND (response!="*dog*" OR response="*no dog*")

View solution in original post

0 Karma

woodcock
Esteemed Legend

Like this:

index=data_log AND (response!="*dog*" OR response="*no dog*")
0 Karma

nidhsha2
New Member

Did the trick, thank you!

0 Karma

skoelpin
SplunkTrust
SplunkTrust

Try this

index=data_log AND (response!="*dog*" OR response="no dog")

0 Karma

nidhsha2
New Member

Unfortunately I did try that, and my response of "no dog" is still not included. I think the != dog takes precedence over my next OR statement?

0 Karma
Get Updates on the Splunk Community!

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

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...

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