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!

Building Reliable Asset and Identity Frameworks in Splunk ES

 Accurate asset and identity resolution is the backbone of security operations. Without it, alerts are ...

Cloud Monitoring Console - Unlocking Greater Visibility in SVC Usage Reporting

For Splunk Cloud customers, understanding and optimizing Splunk Virtual Compute (SVC) usage and resource ...

Automatic Discovery Part 3: Practical Use Cases

If you’ve enabled Automatic Discovery in your install of the Splunk Distribution of the OpenTelemetry ...