# Calculate percentage for the fileds in time range

**URL:** <https://discuss.elastic.co/t/calculate-percentage-for-the-fileds-in-time-range/178261>\
**Category:** Kibana\
**Created:** [April 24, 2019, 1:20pm UTC](https://discuss.elastic.co/t/calculate-percentage-for-the-fileds-in-time-range/178261 "2019-04-24T13:20:22Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ginu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ginu/32/86297_2.png) [@ginu](https://discuss.elastic.co/u/ginu)\
**Post date:** [April 24, 2019, 1:20pm UTC](https://discuss.elastic.co/t/calculate-percentage-for-the-fileds-in-time-range/178261/1 "2019-04-24T13:20:22Z")

</div>

Hi all  
I am having an index which contains  
@timestamp, Status, System, Subsystem...  
the Status has a value like 200, 400, 500

I would like to do a calculation every 5 mins  
`[Sum(Status) where Status:400]/Sum(Status) *100`

and build a graph based on HTTP 400 Error %

I have done the following in timelion :  
`(.es(index=iislogs-*, timefield=log_timestamp,q='sc_status: (400 - 410)).divide (.es(index=iislogs-*, timefield=log_timestamp,q='sc_status: (200 - 510) '))).multiply(100)`

I would like to use this value in a new index or something so that I could create Alert based on the value.  
How can I achieve this? in Kibana? or logstash pipeline?

Regards,  
Ginu

---

<div class="post-metadata">

**Author:** ![LizaD](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lizad/32/51074_2.png) [@LizaD](https://discuss.elastic.co/u/LizaD)\
**Post date:** [April 24, 2019, 8:30pm UTC](https://discuss.elastic.co/t/calculate-percentage-for-the-fileds-in-time-range/178261/2 "2019-04-24T20:30:05Z")

</div>

@mikecote can you help?

---

<div class="post-metadata">

**Author:** ![mikecote](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mikecote/32/58549_2.png) [@mikecote](https://discuss.elastic.co/u/mikecote)\
**Post date:** [April 26, 2019, 3:26am UTC](https://discuss.elastic.co/t/calculate-percentage-for-the-fileds-in-time-range/178261/3 "2019-04-26T03:26:22Z")

</div>

Hi @ginu,

We are currently working on a system that will let you do exactly that. At this time there isn't a solution to my knowledge but keep an eye in the coming releases for a solution. The progress will be updated at this GitHub issue [https://github.com/elastic/kibana/issues/24214](https://github.com/elastic/kibana/issues/24214).

Best,  
Mike.

---

<div class="post-metadata">

**Author:** ![ginu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ginu/32/86297_2.png) [@ginu](https://discuss.elastic.co/u/ginu)\
**Post date:** [April 26, 2019, 7:58am UTC](https://discuss.elastic.co/t/calculate-percentage-for-the-fileds-in-time-range/178261/4 "2019-04-26T07:58:11Z")

</div>

Thanks Mike  
That sounds very promising. I am sure this will be a very needed feature for a lot of other customers.

But for now, do you think there is a possibility to grab this out some how or the other as a Kibana Query or somehow so that I can programmatically implement to have a solution for me now.  
BR, Ginu

---

<div class="post-metadata">

**Author:** ![mikecote](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mikecote/32/58549_2.png) [@mikecote](https://discuss.elastic.co/u/mikecote)\
**Post date:** [April 29, 2019, 6:58pm UTC](https://discuss.elastic.co/t/calculate-percentage-for-the-fileds-in-time-range/178261/5 "2019-04-29T18:58:59Z")

</div>

Hi @ginu

I believe Watcher will do what you're looking for in the meantime. You can find the documentation here: [https://www.elastic.co/guide/en/kibana/7.0/watcher-getting-started.html](https://www.elastic.co/guide/en/kibana/7.0/watcher-getting-started.html).

Mike.

---

<div class="post-metadata">

**Author:** ![ginu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ginu/32/86297_2.png) [@ginu](https://discuss.elastic.co/u/ginu)\
**Post date:** [April 30, 2019, 9:24am UTC](https://discuss.elastic.co/t/calculate-percentage-for-the-fileds-in-time-range/178261/6 "2019-04-30T09:24:36Z")

</div>

Hi Mike  
Thanks for the Tip and Watchers are too complicated. but i will still give it another chance.  
Best Regards  
Ginu

> [@mikecote](#):
>
> Mike

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [May 28, 2019, 9:24am UTC](https://discuss.elastic.co/t/calculate-percentage-for-the-fileds-in-time-range/178261/7 "2019-05-28T09:24:38Z")

</div>

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