Splunk Search

How to compute Windows service uptime and use those totals to produce an uptime percentage?

pc1234
Explorer

I am trying to determine uptime duration on Windows 7036 events. Below is sample data:

TIME SERVICE STATE
10:00 splunk running
10:03 splunk running
10:04 splunk stopped
10:07 splunk stopped
10:10 splunk stopped
10:15 splunk running
10:16 splunk stopped
10:20 splunk running

I'm trying to compute for a period of time (20 mins here) the total time that a service (Splunk here) is in a running or stopped service state. I will then use those totals to produce an uptime percentage. Any suggestions?

thanks in advance,
Peter

0 Karma

gfreitas
Builder

Hi Peter,

I think you can use the transaction command to accomplish that. First you need to have a field that will identify the values "Splunk running" and "Splunk Stopped", let say this field is called splunk_status. Than you can submit the transaction:

your search | transaction splunk_status | stats sum(duration) AS duration by splunk_status

After this search you will have a table with splunk_status and duration fields. Now you can sum both to find total with the command " | addcoltotals".

Hope this helps

0 Karma
Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...