Splunk Search

Lookup works on one instance, but not another

jwalzerpitt
Influencer

I'm seeing a weird issue - I have two Splunk instances, one for prod and one for dev. I have a lookup created that looks for an IP and then compares it to the lookup list to see what CIDR it falls into and then extracts the firewall zone it's in. Here's a search I run in prod that works (returns the firewall zone):

index=foo sourcetype="foo"
| lookup ip_cidr.csv cidr_range as IP_Address
| eval firewall=coalesce(firewall,"null")
| eval context=coalesce(context,"null")
| eval zone=coalesce(zone,"null")
| stats count by IP_Address,zone
| fieldformat count=tostring(count,"commas") 
| sort -count

I get a list of IPs with the zone and the count

On dev, I'm running a similar search against our DNS logs:

index=bind `dns_whitelist`
| lookup ip_cidr.csv cidr_range as src
| eval firewall=coalesce(firewall,"null")
| eval context=coalesce(context,"null")
| eval zone=coalesce(zone,"null")
| stats count by src,zone,query
| fieldformat count=tostring(count,"commas") 
| sort -count

However, for this search the zone is returned as "null" for every IP. I verified the permissions for both the lookup file and the lookup definition and they're both set to Global and All apps.

I'm just at a loss as to what the difference is between the two. Any help would be appreciated.

Thx

0 Karma
1 Solution

Yunagi
Communicator

Have you checked the "Match type" setting for your lookup definitions? You need to click on "Advanced options" when editing a lookup definition to make it visible.
I believe the match type for your first lookup definition (prod) should be: CIDR(IP_Address)
For the second lookup definition (dev), it should be: CIDR(src)

View solution in original post

Yunagi
Communicator

Have you checked the "Match type" setting for your lookup definitions? You need to click on "Advanced options" when editing a lookup definition to make it visible.
I believe the match type for your first lookup definition (prod) should be: CIDR(IP_Address)
For the second lookup definition (dev), it should be: CIDR(src)

jwalzerpitt
Influencer

Thx Yunagi - that was it!

0 Karma

Yunagi
Communicator

You're welcome. 🙂

0 Karma

mdsnmss
SplunkTrust
SplunkTrust

Run |input lookup ip_cidr.csv. Are the lookup tables the same on each instance? Does the lookup field "cidr_range" exist in your dev search? You can run just index=bind 'dns_whitelist' to check that. It seems like the lookup isn't finding anything and is reverting to a default value of null based on the lookup definition. The issues seems to point to a difference in fields between the two logs.

jwalzerpitt
Influencer

I ran | inputlookup ip_cidr.csv on both instances and I'm seeing the same results - 2,439 results - on both instances.

Thx

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!

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...

Step into “Hunt the Insider: An Splunk ES Premier Mystery” to catch a cybercriminal ...

After a whole week of being on call, you fell asleep on your keyboard, and you hit a sequence of buttons that ...