Splunk Search

Check IP against lookup file with IP/CIDRs.

zhatsispgx
Path Finder

Hi all,

I am new to using lookups and I'm a bit confused. I've created a lookup file on my splunk instance called combined-threatlist.csv which has data in it like this:

head /opt/splunk/etc/apps/search/lookups/combined-threatlist.csv

threatip
1.11.244.148/32
1.20.70.243/32
1.27.3.227/32
1.28.125.6/32
1.28.164.232/32
1.28.205.33/32
1.28.206.193/32
1.31.87.35/32
1.32.200.68/32

I have firewall logs sourcetype=pan:traffic that I would like to see if either the src_ip or dest_ip field values match on any of the CIDR/hosts listed in the lookup file. How would I go about doing this? I created the lookup definition named threatlistlookup, and created the lookup table file as well combined-threatlist.csv.

0 Karma

jkat54
SplunkTrust
SplunkTrust

... | eval srcMatch=if(searchmatch([|inputlookup yourlookup| format]),”1”,”0”)

Same for dest but change the field names.

0 Karma

zhatsispgx
Path Finder

Error in 'eval' command: The arguments to the 'searchmatch' function are invalid.
for search:

index=palo sourcetype="pan:threat" | eval srcMatch=if(searchmatch(src_ip,"[|inputlookup threatlistlookup | format]"),"1","0")

0 Karma

jkat54
SplunkTrust
SplunkTrust

I edited the answer, can you try the new search and let me know? Thanks!

0 Karma

zhatsispgx
Path Finder

index=palo sourcetype="pan:threat" | eval srcMatch=if(searchmatch(src_ip,”[|inputlookup threatlistlookup | format]”),”1”,”0”)

Error in 'eval' command: The expression is malformed. An unexpected character is reached at '” ( ( threatip="1.11.244.148/32" ) OR ( threatip="1.20.70.243/32" ) OR ( threatip="1.27.3.227/32" ) OR ( threatip="1.28.125.6/32" ) OR ( threatip="1.28.164.232/32" ) OR ( threatip="1.28.205.33/32" ) OR ( threatip="1.28.206.193/32" ) OR ( threatip="1.31.87.35/32" ) OR ( threatip="1.32.200.68/32" ) OR ( threatip="1.32.200.98/32" ) OR ( threatip="1.34.2.152/32" ) OR ( threatip="1.34.39.59/32" ) OR ( threatip="1.34.49.237/32" ) OR ( threatip="1.34.110.55/32" ) OR ( threatip="1.34.113.192/32" ) OR ( threatip="1.34.209.148/32" ) OR ( threatip="1.36.29.156/32" ) OR ( threatip="1.36.56.213/32" ) OR ( threatip="1.36.83.89/32" ) OR ( threatip="1.36.162.207/32" ) OR ( threatip="1.48.68.27/32" ) ... ,”1”,”0”)'.

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 ...