Splunk Search

How do I do a CIDR match with an inputlookup?

adepasquale
Path Finder

Hi All,

I have a lookup that currently works. I've set match_type to CIDR(netRange) in my transforms file and everything works when I pass it an IP address to find in the range.

However, I'm looking to use this lookup table without a search. So I went with the creating command inputlookup, but for the life of me, I cannot get a CIDR match to work. I want to pass it an IP, and have it find the matching CIDR notation in netRange.

Is there no way to do this with the inputlookup command — why is it not honoring my transform?

This works:

index="main" | eval cip="1.1.1.1" | lookup IP2ASN netRange AS cip

This does not work

|inputlookup IP2ASN where netRange=1.1.1.1
0 Karma
1 Solution

somesoni2
SplunkTrust
SplunkTrust

Try this

| makeresults | eval cip="1.1.1.1" | lookup IP2ASN netRange AS cip

View solution in original post

somesoni2
SplunkTrust
SplunkTrust

Try this

| makeresults | eval cip="1.1.1.1" | lookup IP2ASN netRange AS cip

adepasquale
Path Finder

Gold! thank you, and to be clear... I'm not actually issuing a search with "makeresults"?

0 Karma

somesoni2
SplunkTrust
SplunkTrust

You're running a search command that generates a dummy row (not searching actual indexes). Technically it's still a search.

0 Karma

adepasquale
Path Finder

It'll do, thanks again.

0 Karma

Vijeta
Influencer

@adepasquale Try this-

|inputlookup IP2ASN  | where netRange="1.1.1.1"
0 Karma

adepasquale
Path Finder

This doesn't work either. netRange has values like 1.0.0.0/24, 1.0.1.0/24, 1.1.1.0/24, etc...

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...