Splunk Search
Highlighted

Custom lookup table used in search

Engager

I created a csv file that has two columns, name and ip. I've uploaded the csv and I want to use the name column as list of host to search instead of doing a long list of host in the search and that way I can just update the csv to update all of my searches.

when I run something like:

index=web | lookup computers.csv name AS host

I get a ton of results from host that are not in the csv.

0 Karma
Highlighted

Re: Custom lookup table used in search

Motivator

Hello there, try like this.

index=web [| inputlookup computers.csv | rename name AS host]
0 Karma
Highlighted

Re: Custom lookup table used in search

SplunkTrust
SplunkTrust

The lookup command just enriches the existing data (adds column from lookup based on matched fields) and doesn't do any filter. You'd need to use that lookup table as subsearch filter as well to get data for only matched hosts

 index=web [| inputlookup computers.csv | table name | rename name as host ]  | ...rest of the search
0 Karma
Highlighted

Re: Custom lookup table used in search

Contributor

index=web | lookup computers.csv name AS lkhost | where host==lkhost

You can use subsearches but they have a lot of caviat
index=web NOT [| inputlookup computers.csv | table name | rename name as host ]

0 Karma