Splunk Search

Update lookup file values dynamically

bt149
Path Finder

I have a lookup file.  Lookup has "host", "count", "first_event" and "last_event" fields.  I want to run a search hourly that will update all the fields with fresh values and in the event that a "host" is not found in the search send an alert.

Any guidance would be appreciated.

Labels (1)
Tags (1)
0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @bt149,

for the lookup population search you could try something like this:

<your_search>
| stats 
   count
   earliest(_time) AS first_event
   latest(_time) AS last_event
   BY host
| outputlookup your_lookup.csv

for the alert the fires eventual missing hosts, you could try:

<your_search>
| stats 
   count
   BY host
| append [ | your_lookup | eval count=0 | fields host count]
| stats 
   sum(count) AS count
   BY host
| where count=0

Ciao.

Giuseppe

0 Karma
Get Updates on the Splunk Community!

Index This | Forward, I’m heavy; backward, I’m not. What am I?

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

A Guide To Cloud Migration Success

As enterprises’ rapid expansion to the cloud continues, IT leaders are continuously looking for ways to focus ...

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...