Splunk Search

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


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

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,

0 Karma


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
.conf21 Now Fully Virtual!
Register for FREE Today!

We've made .conf21 totally virtual and totally FREE! Our completely online experience will run from 10/19 through 10/20 with some additional events, too!