Splunk Search

How to search with variables from lookup csv?

fishmong3r
Explorer

Let's say I have a search and a very basic lookup table (csv). What I want to achieve is to use the values in the table for my search.

So my table.csv:

id name
1 first
2 second
3 third

 

Now, I want to simply run a query like which returns every single log that has any of the id's from my lookup table.

index=myIndex sourcetype=mySourcetype id IN somelookup ---- where id is in table.csv's id column.

 

The second challenge then would be to actually have the name column values added as a field to the results for clarity.

Labels (2)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

Try something like this

index=myIndex sourcetype=mySourcetype [ | inputlookup table.csv | fields id ]
| lookup table.csv

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust

Try something like this

index=myIndex sourcetype=mySourcetype [ | inputlookup table.csv | fields id ]
| lookup table.csv

fishmong3r
Explorer

For that, I get "Error in 'lookup' command: Must specify one or more lookup fields."

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
| lookup table.csv id
0 Karma

fishmong3r
Explorer

lovely!

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

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...