Splunk Search

How to add a variable from a lookup table to filter results?

Gggflyer
New Member

I am trying to do a tstats command to get the last logged time a server has sent logs.  My server list i want in the table is in a lookup csv.

The command i am using is 

Tstats latest(_time) as lastseen where (index=windows) by host | convert ctime(lastseen)

The "where" clause i would like to be something like "where the server name is on the lookup table"

 

Basically trying to filter the output of the query to just any server i have in the lookup table

Labels (2)
Tags (1)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

Use a subsearch.

| tstats latest(_time) as lastseen where (index=windows) [ | inputlookup hostlist.csv | fields host | format ] by host 
| convert ctime(lastseen)
---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

September Community Champions: A Shoutout to Our Contributors!

As we close the books on another fantastic month, we want to take a moment to celebrate the people who are the ...

Splunk Decoded: Service Maps vs Service Analyzer Tree View vs Flow Maps

It’s Monday morning, and your phone is buzzing with alert escalations – your customer-facing portal is running ...

What’s New in Splunk Observability – September 2025

What's NewWe are excited to announce the latest enhancements to Splunk Observability, designed to help ITOps ...