Splunk Search

How to lookup in Splunk?

SharmaS2
Explorer

Hi Team,

i have one abc.csv file with  only one colunm as Source_IP where values are in10.10.10.0/24 format .

next i have  index=xyz which has multiple column as dst,city,counrty , src is one of the  column .

here i need all data from index=xyz where Source_IP from abc.csv matches with src column of index=xyz.

i have uploaded the file successfully but unable to find the relevant query to fetch data ..

 

 

Labels (1)
Tags (1)
0 Karma
1 Solution

Stefanie
Builder

Try something like this:

index=xyz [|inputlookup abc.csv |rename "Source_IP" as "src"|return 999 "src"] 

After the search, add a pipe (|) and the rest of your search criteria. 

View solution in original post

0 Karma

SanjayReddy
SplunkTrust
SplunkTrust

Hi @SharmaS2 

Can you try this 

index=xyz
| lookup abc.csv Source_IP as src  
| table src,dst,city,counrty

OR 

index=xyz
| join type=left src
[| lookup abc.csv Source_IP as src
| fields src]

| table src,dst,city,counrty

0 Karma

Stefanie
Builder

Try something like this:

index=xyz [|inputlookup abc.csv |rename "Source_IP" as "src"|return 999 "src"] 

After the search, add a pipe (|) and the rest of your search criteria. 

0 Karma

SharmaS2
Explorer

thanks ..its working properly ..

 

can you please explain what is 

return 999
Tags (1)
0 Karma

Stefanie
Builder

Sure!

The return command returns values from the subsearch (The stuff in your brackets) so that you can use it to compare with your main search. But the return command automatically limits the number of items returned, you have to tell it how many to return. 
Because I don't know how big your csv is, 999 was a safe bet. 🙂

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

Observability Simplified: Combining User Experience, Application Performance & ...

Tech Talk Observability Simplified: Combining User Experience, Application Performance & Network ...

Event Series May & June: From Network Visibility to Service Intelligence

Unifying the Network: Moving from Alert Noise to Service Intelligence with Splunk ITSI In today’s hybrid ...