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

alemarzu
Motivator

Hello there, try like this.

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

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...