Painless calculation based on time interval

Hi,

In the Visual Time Series Builder, when using the calculation aggregation, is it possible to reference the current time interval that kibana selected?

For example, when search for the last 24h and the time interval is 10m, to have something like params.time_intervalequal 600000 (10m in milliseconds) or something similar that gets updated when the interval changes.

Thanks

@shaharmor referencing the interval directly in the calculation script isn't currently possible. Would you mind describing what you were intending to accomplish by doing so, so we can see if there is an alternative approach?

Sure.

We are collecting the amount of bytes downloaded on a per 1m interval in a doc that looks like this:

{
  "timestamp": 1504702131146
  "bytes": 1000
}

And we want to display the average gbps (gigabit per second) over time, regardless of the time interval that Kibana chooses.

Basically we need to do something like this: (params.bytes * 8) / ((params._interval * 1000) * (1000 * 1000 * 1000)), which is bytes as bits/(interval as seconds * bits as gigabits).

Makes sense?

@shaharmor do you have a document for every 1m? It's possible that you could use a count aggregation to determine the total minutes in the bucket to perform the calculation.

I have thousands of docs per 1m bucket, each with different dimensions too
(different values)

@shaharmor to do this, we can follow a very similar approach to what is explained here

The largest difference between what is in the video, and your situation is that the video is dealing with documents that are already calculating the total network traffic over time. That's not the case in your situation, so we're doing a Sum, and then a Cumulative Sum and then what the video describes leaving us with the following configuration:

You'll notice in this solution we're doing kbps as opposed to gbps because my sample data wasn't nearly as extensive as yours, so that will need to be modified.

Thanks Brandon!

It really helps, only problem left is showing the series as Gb/s instead of GB/s (currently Kibana only has Bytes format and not Bits)

@shaharmor good point, we currently have this issue outstanding to support bits in addition to bytes, if you wouldn't mind +1ing it or adding a comment it'll help us prioritize it appropriately.

Done.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.