Ok guys, I'm trying to figure out how to basically create a report of service down time durations.
Let say I run the report for the past 48 hours, and this report would bring up each instance and the columns of the table would look like this:
outage start,outage stop,total duration (in minutes),host,service name
Let's say there were two instances where services were down, and two different times in the day.
The report would pull up both of them as individual rows within the table.
I'm pretty sure I'm going to be using buckets somehow, but I'm searching for the easiest way to pull up each of the 'down' instances, and their duration in a table for a period of time.
To give you some more information, I am just looking for a 'State' change, from 'up' to 'down' and the duration of it until the next 'up' change. I have the field extracted within each event already.
I have tried the answer below, and it's almost what i'm after.
I'm trying to keep it as simple as possible so basically i'm looking for the following fields for each 'outage'
Start time, Stop Time, duration, service name.
This is the query I am using:
sourcetype=WMI:Service Name=<servicename> | streamstats current=false last(State) as last_service_status last(_time) as time_of_change by Name | where State!="last_service_status" | eval outage=now()-time_of_change | eval duration=strftime(outage, "%H:%M") | rename State as current_service_status | table time_of_change, Name, last_service_status, current_service_status, duration
and this is an image of the results.
Is there a way to peel these fields out into a table of the 'outages' and duration's by service name?
... View more