Splunk Search

Custom lookup table used in search

mpunderw
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

valiquet
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

somesoni2
Revered Legend

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

alemarzu
Motivator

Hello there, try like this.

index=web [| inputlookup computers.csv | rename name AS host]
0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...