Splunk Search

Need to search IP address in a list of IP/CIDR list and if matched need to return the Name associated with it.

sahastrabuddhe
Engager

I have a lookup table with 2 fields IP and Name

IP Name

['1.2.3.4', '2.3.5.0/24'] -> name1

['1.2.3.4',.6.7.8.9/31, 4.5.6.7,1.1.1.1] -> name2

[3.3.3.3/31, 4.4.4.4] -> name3

 

I have a list of IPs like "1.2.3.4, 2.3.5.1"

 

This should give me result of lookup table names where the IPs are present.

So in the above example result would be as the "1.2.3.4, 2.3.5.1" are present in first 2 rows.

name1

name2

 

Labels (1)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

Unless the lookup is defined with the CIDR, WILDCARD, or case-insensitive option, it will do exact string matching.  Even with those options, there is no way to get "1.2.3.4" to match "['1.2.3.4', '2.3.5.0/24']".  The multiple IP addresses in each line should be put on separate lines.

IPName
1.2.3.4name1
2.3.5.0/24name1
1.2.3.4name2
6.7.8.9/31name2
4.5.6.7name2
1.1.1.1name2
3.3.3.3/31name3
4.4.4.4name3

 

Note that the IP field is ambiguous because both name1 and name2 share an IP address.  The lookup command will return only the first matching IP.

---
If this reply helps you, Karma would be appreciated.

sahastrabuddhe
Engager

How should I format the lookup definition so that it takes both CIDR match and indivisual IP match
What I mean to say is if I go to advance settings and change the match criteria to CIDR(IP) its not matching the elements where the IP is single IP and not a CIDR 

0 Karma

richgalloway
SplunkTrust
SplunkTrust

I think you have to make all IP values CIDR (1.2.3.4/32, for example).

---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Enterprise Security Content Update (ESCU) | New Releases

In December, the Splunk Threat Research Team had 1 release of new security content via the Enterprise Security ...

Why am I not seeing the finding in Splunk Enterprise Security Analyst Queue?

(This is the first of a series of 2 blogs). Splunk Enterprise Security is a fantastic tool that offers robust ...

Index This | What are the 12 Days of Splunk-mas?

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