Refine your search:

0
1

How to plot running sums? Eg given events with fields "time host errors", I'd like to do

  • | timechart accum(errors) by host

but timechart doesn't have accum, and accum doesn't have "by".

The below gets close:

  • | reverse | streamstats sum(errors) AS RunningSum by host window=10000 global=f | timechart sum(RunningSum) by host

but RunningSum sometimes decreases (which I don't understand or want), and there are definitely less than 10000 events so I don't think window size is the reason.

asked 04 Jun '10, 23:08

jrstear's gravatar image

jrstear
1606
accept rate: 14%

edited 05 May '11, 14:47

jlaw's gravatar image

jlaw ♦
74148


One Answer:

This is somewhat tricky to do. Basically we first discretize time, like timechart does, so that we can calculate statistics per time bin. Then we count the errors in each time bin using stats. Next we use streamstats to achieve the accumulation. Last we use timechart to put it all together. A search like this should work:

... | bin _time | stats count as errors by _time host | streamstats sum(errors) as errors by series | timechart max(errors) by series
link

answered 04 Jun '10, 23:20

Stephen%20Sorkin's gravatar image

Stephen Sorkin ♦
8.9k510
accept rate: 52%

The | bin _time | stats count didn't work for me. Instead I substituted it with another | timechart sum() and it worked fine.

(09 Dec '10, 23:54) Jason
Post your answer
toggle preview

Follow this question

Log In to enable email subscriptions

RSS:

Answers

Answers + Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×396
×290
×230

Asked: 04 Jun '10, 23:08

Seen: 1,957 times

Last updated: 05 May '11, 14:47

Copyright © 2005-2012 Splunk Inc. All rights reserved.