Splunk Search

How to exclude events through lookup?

mmoermans
Path Finder

Hi there,

trying to exclude some events through the use of a lookup but it's not working for some reason:

index=main src_ip="192.168.0.0/16" (dest_ip!="127.0.0.1" OR dest_ip!="127.0.0.2") | dedup dest_ip | lookup dns.csv destdns_ip as dest_ip OUTPUTNEW query  | search NOT [| inputlookup dns_excludes.csv | fields query ] | table dest_ip,query

dns.csv
dest_ip, query
127.0.0.5, windows.com

dns_excludes.csv
query
windows.com

It shows the data normally but doesn't exclude the dns_excludes.csv. Does anyone know what I'm doing wrong here?

0 Karma
1 Solution

somesoni2
Revered Legend

What does your lookup table contains? (provide field names and their sample values)

Also, give this a try (query is a special keyword in Splunk, so avoiding that)

 index=main src_ip="192.168.0.0/16" (dest_ip!="127.0.0.1" OR dest_ip!="127.0.0.2") | dedup dest_ip | lookup dns.csv destdns_ip as dest_ip OUTPUTNEW query  as query1 | search NOT [| inputlookup dns_excludes.csv | fields query | rename query as query1 ] 
 rename query1 as query | table dest_ip,query

View solution in original post

0 Karma

somesoni2
Revered Legend

What does your lookup table contains? (provide field names and their sample values)

Also, give this a try (query is a special keyword in Splunk, so avoiding that)

 index=main src_ip="192.168.0.0/16" (dest_ip!="127.0.0.1" OR dest_ip!="127.0.0.2") | dedup dest_ip | lookup dns.csv destdns_ip as dest_ip OUTPUTNEW query  as query1 | search NOT [| inputlookup dns_excludes.csv | fields query | rename query as query1 ] 
 rename query1 as query | table dest_ip,query
0 Karma

mmoermans
Path Finder

This fixed it, thanks!

0 Karma

MuS
SplunkTrust
SplunkTrust

Hi @mmoermans, please accept this answer if it helped to solve your problem.

cheers, MuS

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Index This | What travels the world but is also stuck in place?

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

Discover New Use Cases: Unlock Greater Value from Your Existing Splunk Data

Realizing the full potential of your Splunk investment requires more than just understanding current usage; it ...

Continue Your Journey: Join Session 2 of the Data Management and Federation Bootcamp ...

As data volumes continue to grow and environments become more distributed, managing and optimizing data ...