Kibana Dynamically Time Filter

I need to show daily/weekly/monthly average of duration of my job with Gauge in Kibana.
We can call this graph as daily/weekly/monthly load percente of machine.

I have duration-time-in-day field in index. want to sum duration-time-in-day and divide with selected range in day.

For example; my date time selection field is

Jul 27, 2020 @ 00:00:00.000 -> Jul 28, 2020 @ 00:00:00.000

its a single day.
So that my requirement


or my other time filter selection

last 7 days

sum(duration-in-day for last 7 days) / 7

I try to use Bucket script may close for this. But i could not find to get the right way of the date range dynamically.

Any advice for this ?

Hi @alparslan,
I think what could do the trick in this case is to use TSVB.
You need to setup interval of the duration of 1d (that'll guarantee that you have as many buckets as days). Then configure following metrics as on the screenshot below:

  • count
  • overall sum of count
  • sum of duration-time-in-day
  • overall sum of "sum of duration-time-in-day"
  • math: params.sum/params.sumOfCount- we're dividing the whole duration by numbers of buckets

Let me know if it works for you!

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