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!

Introducing the 2024 SplunkTrust!

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

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...