Splunk Search

Best way to exclude specific combinations from results

gdavid
Path Finder

I have a report that i get and it contains specific sets of data results i want to exclude:
ex:

Group Name, Who Change It, Who Changed in the Group, Add/Removed

i want to exclude results for a specific set of Group Name, Who Change It & Who Changed in the Group

My AD Group1 , admin1, user1
My AD Group2 , admin1, user2
My AD Group3 , admin2, user2

what is the best scalable way to do this, just curious if there is a better way than make my query a page long and adding in the exclusion sets there.

Tags (2)
1 Solution

DalJeanis
Legend

You can just put the exclusion sets into a lookup table myexclusion.csv with the fields group user1 user2 excludereason

your query 
| fields group user1 user2 some other stuff 
| lookup myexclusion.csv group user1 user2 OUTPUT excludereason
| where isnull(excludereason)

See the lookup command for details on how to look things up when the name of the external field does not match the name of the lookup key field(s).

http://docs.splunk.com/Documentation/SplunkCloud/6.6.1/SearchReference/Lookup

I believe if the user1 field in the lookup is named "foo" in the event, then the syntax is

| lookup mylookup.csv   user1 as foo   OUTPUT bar

View solution in original post

lfedak_splunk
Splunk Employee
Splunk Employee

Hey @gdavid, if DalJeanis solved your problem, please don't forget to accept an answer! You can upvote posts as well. (Karma points will be awarded for either action.) Happy Splunking!

0 Karma

DalJeanis
Legend

You can just put the exclusion sets into a lookup table myexclusion.csv with the fields group user1 user2 excludereason

your query 
| fields group user1 user2 some other stuff 
| lookup myexclusion.csv group user1 user2 OUTPUT excludereason
| where isnull(excludereason)

See the lookup command for details on how to look things up when the name of the external field does not match the name of the lookup key field(s).

http://docs.splunk.com/Documentation/SplunkCloud/6.6.1/SearchReference/Lookup

I believe if the user1 field in the lookup is named "foo" in the event, then the syntax is

| lookup mylookup.csv   user1 as foo   OUTPUT bar

gdavid
Path Finder

Thanks, i was looking into how to do this with a lookup and your example helped clear up a bunch of questions.
FYI, excludereason is key 🙂

DalJeanis
Legend

@gdavid - True. I believe there are other ways to figure out if it was a match, but that's the easy one for me.

0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

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

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...