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!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...