Splunk Search

Add a lookup csv colum information to the results of a inputlookup search

Mannyi31
Explorer

Hi,

I have a lookup search that works fine but I would like to add information from the lookup table that the source log does not have. let me explain:

example of lookup table called ipwatchlist.csv:

category ip_address isbad

Fake-AV 109.235.251.49 TRUE

Fake-AV 109.235.251.51 TRUE

This is my search:
sourcetype=firewall [|inputlookup ipwatchlist.csv | fields ip_address | rename ip_address as dest_ip] | stats count by src_ip dest_ip | sort desc - count

This gives me a result of:

src_ip dest_ip count

192.168.1.1 109.235.251.49 50

Now I would like to add the field in the ipwatchlist.csv of category to see what is the IP associated with, I would like to get a result like:

src_ip dest_ip Category count

192.168.1.1 109.235.251.49 Fake-AV 50

Does anyone has an idea how to do this?

1 Solution

Ayn
Legend

Well you already have ipwatchlist.csv as a lookup table to just use that 🙂

sourcetype=firewall [|inputlookup ipwatchlist.csv | fields ip_address | rename ip_address as dest_ip] | stats count by src_ip dest_ip | sort desc - count | lookup ipwatchlist.csv dest_ip OUTPUT Category | table src_ip dest_ip Category count

View solution in original post

Ayn
Legend

Well you already have ipwatchlist.csv as a lookup table to just use that 🙂

sourcetype=firewall [|inputlookup ipwatchlist.csv | fields ip_address | rename ip_address as dest_ip] | stats count by src_ip dest_ip | sort desc - count | lookup ipwatchlist.csv dest_ip OUTPUT Category | table src_ip dest_ip Category count

Ayn
Legend

Awesome. Could you please mark my answer as accepted? Thanks!

0 Karma

Mannyi31
Explorer

Thanks Ayn, Your answer worked after I made some modifications and below is the end result:

sourcetype=firewall [|inputlookup ipwatchlist.csv | fields ip_address | rename ip_address as dest_ip] | stats count by src_ip dest_ip | sort desc - count | lookup ipwatchlist ip_address as dest_ip OUTPUT category | table src_ip dest_ip category count

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

.conf25 Global Broadcast: Don’t Miss a Moment

Hello Splunkers, .conf25 is only a click away.  Not able to make it to .conf25 in person? No worries, you can ...

Observe and Secure All Apps with Splunk

 Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

What's New in Splunk Observability - August 2025

What's New We are excited to announce the latest enhancements to Splunk Observability Cloud as well as what is ...