Splunk Search

Check if time is within last 3 hrs

shakSplunk
Path Finder

Hi all,

I am looking to check if there has been a event within the last 3 hrs for three different categories. 

If an event has been detected in the last 3 hours, I would like a status column that says "Registry In Sync", otherwise the status column should read "Out of Sync".  Something like the following:

 

Type

_time

Status

A

2021-08-10 09:27:07

Out of Sync

B

2021-08-23 01:24:56

Registry is in Sync

C

2021-08-19 23:25:28

Out of Sync

 

The important this is that it is categorised by the Type field. 

I appreciate any and all help!

Labels (2)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
| stats latest(_time) as _time by type
| eval status=if(now()-_time<(60*60*3),"Registry is in sync","Out of sync")
0 Karma

shakSplunk
Path Finder

Thanks @ITWhisperer 

Is there any way to rename "_time" to "Last Update" without changing how the date format looks?

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

_time has a default format so if you rename it, you have to reapply the formatting, you can do this with fieldformat so it doesn't change the value of the field, just how it is displayed.

0 Karma
Get Updates on the Splunk Community!

Splunk + ThousandEyes: Correlate frontend, app, and network data to troubleshoot ...

 Are you tired of troubleshooting delays caused by siloed frontend, application, and network data? We've got a ...

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...

🔐 Trust at Every Hop: How mTLS in Splunk Enterprise 10.0 Makes Security Simpler

From Idea to Implementation: Why Splunk Built mTLS into Splunk Enterprise 10.0  mTLS wasn’t just a checkbox ...