Splunk Search

How to generate an alert when a sourcetype stops sending logs?

nicholas_bergma
New Member

I've found quite a few articles on how to alert on a specific source/sourcetype, but I want to alert of any sourcetype that hasn't had any log data for over 24 hours. Is there a way to create an alert for when the sourcetype reaches that 24 hour threshold? Here's the search I'm running currently with the timepicker set to Relative:24 hrs

| metadata type=sourcetypes index=*
| convert ctime(lastTime) as Last_Time timeformat="%Y/%m/%d %H:%M"
| search sourcetype!=*too_small 
| where lastTime < (now() - 86400) 
| fields sourcetype Last_Time
| sort -Last_Time
0 Karma

somesoni2
SplunkTrust
SplunkTrust

Try like this (Time Range Picker should be more than 24Hrs so that you include the last event from that sourcetype and compare against your criteria). Just changed to order of statements as well.

| metadata type=sourcetypes index=*
| search sourcetype!=*too_small 
| where lastTime < (now() - 86400) 
| convert ctime(lastTime) as Last_Time timeformat="%Y/%m/%d %H:%M"
| fields sourcetype Last_Time
| sort -Last_Time
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 ...