Splunk Search

How to compare contents of one lookup to another?

atebysandwich
Path Finder

Currently I have an inputlookup csv that contains a list of IP addresses and lookup csv that has a list of subnets. I would like to create a query that shows the IPs in the inputlookup table that are not part of the subnets specified in the lookup. I am stumped on how to do this any instance would be greatly appreciated. 

Labels (3)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

There is no difference between an "inputlookup csv" and a "lookup csv".  They're both CSVs.  Inputlookup and lookup are just two methods for accessing those files.

Create a lookup definition (Settings->Lookups->Lookup definitions) that references the subnets CSV.  In the Advanced settings, put CIDR(subnet) in the Match type box. (Replace "subnet" with the actual name of the subnet field.)

Now you can search for all of the entries in the addresses CSV that don't have a match in the subnets CSV.

| inputlookup addresses.csv
| lookup subnets address AS subnet OUTPUT subnet AS match
| where isnull(match)
---
If this reply helps you, Karma would be appreciated.
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Thanks for the Memories! Splunk University, .conf25, and our Community

Thank you to everyone in the Splunk Community who joined us for .conf25, which kicked off with our iconic ...

Data Persistence in the OpenTelemetry Collector

This blog post is part of an ongoing series on OpenTelemetry. What happens if the OpenTelemetry collector ...

Introducing Splunk 10.0: Smarter, Faster, and More Powerful Than Ever

Now On Demand Whether you're managing complex deployments or looking to future-proof your data ...