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!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...