# Kibana configure alert based upon dynamic value

**URL:** https://discuss.elastic.co/t/kibana-configure-alert-based-upon-dynamic-value/326132
**Category:** Kibana
**Tags:** elastic-stack-alerting, kql-kibana-query-language
**Created:** [February 22, 2023, 7:22am UTC](https://discuss.elastic.co/t/kibana-configure-alert-based-upon-dynamic-value/326132 "2023-02-22T07:22:59Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![Raj4](https://avatars.discourse-cdn.com/v4/letter/r/b5a626/32.png) [@Raj4](https://discuss.elastic.co/u/Raj4)
#### Post date: [February 22, 2023, 7:23am UTC](https://discuss.elastic.co/t/kibana-configure-alert-based-upon-dynamic-value/326132/1 "2023-02-22T07:23:00Z")

</div>

Hello All,  
I am new to Kibana, I need to achieve the below. Please advise.

I am using formula to calculate one column data, I want to alert only if the calculated column value is greater than 5% difference.

Example:  
Col1 Col2 Col3\_Calculated  
10 15 50%  
20 21 0.5%  
.  
Here my row1 calculated field (col3\_calcualted) field difference is greater than 5%, in such case I need to send an alert once.  
Please guide me with the steps

---

<div class="post-metadata">

### Author: ![hendry.lim](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hendry.lim/32/71328_2.png) [@hendry.lim](https://discuss.elastic.co/u/hendry.lim)
#### Post date: [February 22, 2023, 7:30am UTC](https://discuss.elastic.co/t/kibana-configure-alert-based-upon-dynamic-value/326132/2 "2023-02-22T07:30:35Z")

</div>

You can create a runtime field to store the calculated/difference value and then create a threshold rule to trigger an alert.

---

<div class="post-metadata">

### Author: ![Raj4](https://avatars.discourse-cdn.com/v4/letter/r/b5a626/32.png) [@Raj4](https://discuss.elastic.co/u/Raj4)
#### Post date: [February 22, 2023, 7:58am UTC](https://discuss.elastic.co/t/kibana-configure-alert-based-upon-dynamic-value/326132/3 "2023-02-22T07:58:26Z")

</div>

Thanks Hendry,  
Actually I am uploading CSV file into Elasticsearch and building Dashboard based on Kibana.  
So where i need to create this runtime field, please let me know in detail

---

<div class="post-metadata">

### Author: ![hendry.lim](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hendry.lim/32/71328_2.png) [@hendry.lim](https://discuss.elastic.co/u/hendry.lim)
#### Post date: [February 22, 2023, 8:30am UTC](https://discuss.elastic.co/t/kibana-configure-alert-based-upon-dynamic-value/326132/4 "2023-02-22T08:30:14Z")

</div>

You can refer to the doc [Map a runtime field | Elasticsearch Guide [8.6] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/runtime-mapping-fields.html).

---

<div class="post-metadata">

### Author: ![Raj4](https://avatars.discourse-cdn.com/v4/letter/r/b5a626/32.png) [@Raj4](https://discuss.elastic.co/u/Raj4)
#### Post date: [February 22, 2023, 10:19am UTC](https://discuss.elastic.co/t/kibana-configure-alert-based-upon-dynamic-value/326132/5 "2023-02-22T10:19:20Z")

</div>

Hendry,  
Is it possible for me to do the same in Kibana directly instead of moving to DevTool.  
Because all the example shown are using the Devtool and writing JSON, but my requirement is, already I am loading the data from Elasticsearch and in Kibana how can I just create one more calculated field and alert based upon the dynamic value

---

<div class="post-metadata">

### Author: ![hendry.lim](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hendry.lim/32/71328_2.png) [@hendry.lim](https://discuss.elastic.co/u/hendry.lim)
#### Post date: [February 22, 2023, 10:34am UTC](https://discuss.elastic.co/t/kibana-configure-alert-based-upon-dynamic-value/326132/6 "2023-02-22T10:34:28Z")

</div>

Yes, you can create `runtime` field in Kibana Data View.

---

<div class="post-metadata">

### Author: ![Raj4](https://avatars.discourse-cdn.com/v4/letter/r/b5a626/32.png) [@Raj4](https://discuss.elastic.co/u/Raj4)
#### Post date: [February 22, 2023, 11:03am UTC](https://discuss.elastic.co/t/kibana-configure-alert-based-upon-dynamic-value/326132/7 "2023-02-22T11:03:08Z")

</div>

Super !  
This works...

Could you please let me know how to find difference between **current day value and previous day value** using runtime field.

shift = '1d' is not working.

---

<div class="post-metadata">

### Author: ![hendry.lim](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hendry.lim/32/71328_2.png) [@hendry.lim](https://discuss.elastic.co/u/hendry.lim)
#### Post date: [February 22, 2023, 11:29am UTC](https://discuss.elastic.co/t/kibana-configure-alert-based-upon-dynamic-value/326132/8 "2023-02-22T11:29:38Z")

</div>

Time shift function is only available in Lens. What are you trying to do?

---

<div class="post-metadata">

### Author: ![Raj4](https://avatars.discourse-cdn.com/v4/letter/r/b5a626/32.png) [@Raj4](https://discuss.elastic.co/u/Raj4)
#### Post date: [February 22, 2023, 11:37am UTC](https://discuss.elastic.co/t/kibana-configure-alert-based-upon-dynamic-value/326132/9 "2023-02-22T11:37:26Z")

</div>

Please find below detaiks

**Requirement 1**  
I will am having the data in the below way

Col1\_Date Col2\_val  
01-JAN-2023 100  
02-JAN-2023 200

I want to find the difference between 100 and 200 and display in a calculated field and if the difference is morethan 5% I need to send an alert.

**Requirement 2**  
I will am having the data in the below way

Col1\_Date Col2\_Source Col2\_val  
01-JAN-2023 Source1 100  
01-JAN-2023 Source2 200

I want to find the difference between source1 and source2 value for the same date and display in a calculated field and if the difference is morethan 5% I need to send an alert.

---

<div class="post-metadata">

### Author: ![hendry.lim](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hendry.lim/32/71328_2.png) [@hendry.lim](https://discuss.elastic.co/u/hendry.lim)
#### Post date: [March 4, 2023, 3:15am UTC](https://discuss.elastic.co/t/kibana-configure-alert-based-upon-dynamic-value/326132/10 "2023-03-04T03:15:35Z")

</div>

First of all, you can't use `runtime` field for this scenario, because you are trying to perform calculation against multiple documents.

The only way you can do this will be to either use Elasticsearch Watcher to periodically perform the calculation and trigger an alert if the condition is met.

Another option will be to use Elasticsearch transform to regularly perform the calculation, store the result in a separate index, and then you can create chart/alerting rule based on the aggregated index.

---

<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: [April 1, 2023, 3:16am UTC](https://discuss.elastic.co/t/kibana-configure-alert-based-upon-dynamic-value/326132/11 "2023-04-01T03:16:11Z")

</div>

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