Splunk Search

Excluding rows based on field combination

jbdumoulin
Engager

Hello splunkers !

Today I'm building a report, in which I'm tasked to exclude some specific results. These are typical windows authentication logs.
I have certain IP's, and logon type, which when they match should be excluded.

For instance, let's say I have an authentication from IP 195.16.108.1 and a logon type 4, I must exclude it from the report. But I can't specify in my alert

ip="195.16.108.1" AND logon_type!=4

That would only select IP 195.16.108.1 while I want to keep every IP, except 195.16.108.1 when logon type equals 4.

I found a solution with the eval function :

 ... request ...|   eval exclude=if(( ip="195.16.108.1" AND logon_type="4"), "true", "false")) | where exclude!="true" | ... do some formating ...

I wonder then : isn't there another solution to my problem ? Because this one sounds counter intuitiv, having to create a new field with a specific value only to sort which row to keep and which ones to exclude.

Tags (2)
0 Karma
1 Solution

gcusello
SplunkTrust
SplunkTrust

Hi jbdumoulin,
try to use parenthesis:

index=my_index NOT (ip="195.16.108.1" logon_type=4)
| ...

Bye.
Giuseppe

View solution in original post

gcusello
SplunkTrust
SplunkTrust

Hi jbdumoulin,
try to use parenthesis:

index=my_index NOT (ip="195.16.108.1" logon_type=4)
| ...

Bye.
Giuseppe

jbdumoulin
Engager

Thanks, really simple solution indeed.

0 Karma
Get Updates on the Splunk Community!

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...

Splunk APM: New Product Features + Community Office Hours Recap!

Howdy Splunk Community! Over the past few months, we’ve had a lot going on in the world of Splunk Application ...

Index This | Forward, I’m heavy; backward, I’m not. What am I?

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