Splunk Search

How to edit my search to find the difference between Downtime and Uptime, and also find percentage down time?

gandusarath
Engager

Hi,

1.We need to find difference between Downtime and Uptime: In the below example it went down at 18:06:02.299 and came up at 18:12:02.005 (we need to find difference in minutes. here it is around 5 mins).
2. We need to add two more fields difference, Percentage down time (difference we get from above/24*60) - Probably we can use eval command to do this.
3. The above query I have used for 30 days. It went down only one day (17 Jan). We need to create a dashboard such that it should show 100% up for remaining 29 days (except 17th Jan) and 17th Jan it should show as 98% Up and 2% down

Below is the search used:

index=_internal sourcetype=scheduler alert_actions!="" (down OR up) user=admin   savedsearch_id="admin;search; Prod Silo 1 is Down" OR savedsearch_id= "admin;search; Prod Silo 1 is UP" 
|chart count(savedsearch_id) by _time,savedsearch_id|rename "admin;search;Prod Silo 1 is Down"  as "SILO1_Down", "admin;search; Prod Silo 1 is UP" as SILO1_UpTime
| convert ctime(_time)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

The key to calculating time differences is to convert both times to epoch time using strptime(). Use an eval to compute the difference then display the result using fieldformat or strftime.

---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Introducing Splunk Enterprise 9.2

WATCH HERE! Watch this Tech Talk to learn about the latest features and enhancements shipped in the new Splunk ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...