Splunk Search

Exclude results where two or more fields match

iomega311
Explorer

I am trying to understand how to remove results where "field_a" and "field_a" each contain a certain value together in the same log... but not all results containing "field_a" or all results containing "field_b"... or any other fields.

Here are some example of logs:

field_a=5 field_b=3

field_a=5 field_b=2

field_a=2 field_b=3

I want to exclude only logs where field_a is equal to "5" AND field_b is equal to "3" ... but keep all other results. So, in the log examples above, I would only want to exclude the first log because that is the only example where BOTH fields contain a specific value... I would want my query to return the last two logs.

0 Karma
1 Solution

sbuntin_splunk
Splunk Employee
Splunk Employee

NOT ( field_a=5 AND field_b=3 )

add this within your base search or in subsequent search command

View solution in original post

richgalloway
SplunkTrust
SplunkTrust

Perhaps this will help.

index=foo NOT (field_a=5 AND field_b=3)
---
If this reply helps you, Karma would be appreciated.

sbuntin_splunk
Splunk Employee
Splunk Employee

NOT ( field_a=5 AND field_b=3 )

add this within your base search or in subsequent search command

Get Updates on the Splunk Community!

Data Management Digest – December 2025

Welcome to the December edition of Data Management Digest! As we continue our journey of data innovation, the ...

Index This | What is broken 80% of the time by February?

December 2025 Edition   Hayyy Splunk Education Enthusiasts and the Eternally Curious!    We’re back with this ...

Unlock Faster Time-to-Value on Edge and Ingest Processor with New SPL2 Pipeline ...

Hello Splunk Community,   We're thrilled to share an exciting update that will help you manage your data more ...