 # Sum of averages

Hi,

i have the problem to sum the two different avarges of the same field in condition of two other (aggregateable) fields of the same log.

Guess my log is parsed in something like this: [timestamp][event][duration]
now my events are work / sleep / eat / play etc and the duration varies everytime.
I need to know to calculate for a given period of time in average i spent playing and working or eating and playing or working and sleeping etc.
So in Excel it is easy. Export average timeline of sleep and average timeline of play and sum up each hour and excel doing the graph easily.

How to reach the goal in Kibana?
I am on 6.4 right now.

Thanks for help.

Solved it on my own using timelion.

``````.es(index=indexname*, q=eat, metric=avg:duration).sum(.es(index=indexname*, q=play, metric=avg:duration))
``````

or

``````.es(index=indexname*, q=play, metric=avg:duration).sum(.es(index=indexname*, q=eat, metric=avg:duration)).sum(.es(index=indexname*, q=work, metric=avg:duration).sum(.es(index=indexname*, q=sleep, metric=avg:duration)))
``````

Hope this helps.

soprabs

1 Like

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