# Formulas in Logsatsh

**URL:** https://discuss.elastic.co/t/formulas-in-logsatsh/234650
**Category:** Logstash
**Created:** [May 28, 2020, 4:56am UTC](https://discuss.elastic.co/t/formulas-in-logsatsh/234650 "2020-05-28T04:56:29Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![katara](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/katara/32/60143_2.png) [@katara](https://discuss.elastic.co/u/katara)
#### Post date: [May 28, 2020, 4:56am UTC](https://discuss.elastic.co/t/formulas-in-logsatsh/234650/1 "2020-05-28T04:56:29Z")

</div>

Hi,  
I have a column in my source data which says if a ticket has met its SLAs.

met\_sla: true  
or  
met\_sla: false

I wanna calculate the below in Logstash and create a new field called target percent

Target= (count(met\_sal: true)/ count(met\_sla)) \*100

How do i do this?

Is this also possible in Kibana wit DSL queries?

---

<div class="post-metadata">

### Author: ![Ranjith\_M](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ranjith_m/32/19272_2.png) [@Ranjith\_M](https://discuss.elastic.co/u/Ranjith_M)
#### Post date: [May 28, 2020, 5:46am UTC](https://discuss.elastic.co/t/formulas-in-logsatsh/234650/2 "2020-05-28T05:46:06Z")

</div>

@katara

If your question is building visualisation in kibana on the derived field, then the answer is No.

You can easily implement this using logstash ruby filter, and it will be efficient to do calculations during ingestion.

Check this link [https://www.elastic.co/guide/en/logstash/current/plugins-filters-ruby.html](https://www.elastic.co/guide/en/logstash/current/plugins-filters-ruby.html)

---

<div class="post-metadata">

### Author: ![katara](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/katara/32/60143_2.png) [@katara](https://discuss.elastic.co/u/katara)
#### Post date: [May 28, 2020, 5:48am UTC](https://discuss.elastic.co/t/formulas-in-logsatsh/234650/3 "2020-05-28T05:48:15Z")

</div>

@Ranjith_M, Would i also be able to collect count aggregations in ruby?

---

<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: [June 25, 2020, 5:48am UTC](https://discuss.elastic.co/t/formulas-in-logsatsh/234650/4 "2020-06-25T05:48:18Z")

</div>

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