Splunk Search

Lookup from CSV and output another column

logtastic
Explorer

Hello,

I am comparing a host.csv file with two columns "IP" and "DNS" I want to compare the IP column to my base search and also output the DNS column from the CSV. I have the following working by renaming the IP column from my CSV to the src_ip field in Splunk but I need help with outputting the DNS column from excel:

 

index=test 
    [| inputlookup hosts.csv 
    | rename IP as src_ip
    | fields src_ip]
| stats count(src_ip) by sourcetype

 

 

I tried a few things but no luck. Thank you!

Labels (5)
0 Karma
1 Solution

venkatasri
SplunkTrust
SplunkTrust

Hi @logtastic 

You can try following query.

 

index=test 
    [| inputlookup hosts.csv 
    | rename IP as src_ip
    | fields src_ip] 
| fields src_ip sourcetype
| lookup hosts.csv IP as src_ip OUTPUTNEW dns
| stats count(src_ip) by sourcetype
 

 

-------------

An upvote would be appreciated if it helps!

 

View solution in original post

Tags (2)

venkatasri
SplunkTrust
SplunkTrust

Hi @logtastic 

You can try following query.

 

index=test 
    [| inputlookup hosts.csv 
    | rename IP as src_ip
    | fields src_ip] 
| fields src_ip sourcetype
| lookup hosts.csv IP as src_ip OUTPUTNEW dns
| stats count(src_ip) by sourcetype
 

 

-------------

An upvote would be appreciated if it helps!

 

Tags (2)
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!

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

Introduction to Splunk AI

How are you using AI in Splunk? Whether you see AI as a threat or opportunity, AI is here to stay. Lucky for ...