It sounds like you will have to build an SPL query using the eventstats command, or possibly the streamstats command. Since I can't see your data I'm not sure what would be the best approach, but there is a slight difference between these two commands. Eventstats is like the stats command where it looks at all of your events matching found by your query, but it does not transform the stream, it just adds additional fields to every event. For example, you could count your up and bad events using eventstats by host. Then, each event for that host would have the total counts on every event. So if there were six up events, and seven bad events for a host, then each of those 13 events would have an up value of six and bad value of seven. Alternatively, streamstats only looks at events in the stream up to and including the point where you are in the stream - it doesn't know about "future" events in the result set. This is good for stuff like running average, but has other uses. So in your case, the first up event would have a count of 1, the second up event a count of two, the first bad event a count of 1, and so on...the last up would have a count of six and the last bad a count of seven. I know you mentioned duration...you can also add-up the time differences using these commands, too, by doing math on _time.
... View more