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.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...