# Custom/Derived Metric?

**URL:** <https://discuss.elastic.co/t/custom-derived-metric/235625>\
**Category:** Kibana\
**Created:** [June 3, 2020, 7:31pm UTC](https://discuss.elastic.co/t/custom-derived-metric/235625 "2020-06-03T19:31:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mpn17](https://avatars.discourse-cdn.com/v4/letter/m/b487fb/32.png) [@mpn17](https://discuss.elastic.co/u/mpn17)\
**Post date:** [June 3, 2020, 7:31pm UTC](https://discuss.elastic.co/t/custom-derived-metric/235625/1 "2020-06-03T19:31:37Z")

</div>

Hi All!

I'm new to Elasticsearch and Kibana and trying to figure out the best way to create a custom metric that takes into account the current value of other metrics.

For example lets say I want to create a custom string metric to look at my host's health. I'm collecting CPU % and Mem Usage and I want to create a derived metric (string) based off the current value of the CPU and Mem Usage metrics. What's the best way to achieve this?

Thanks!

---

<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:** [June 18, 2020, 6:42pm UTC](https://discuss.elastic.co/t/custom-derived-metric/235625/2 "2020-06-18T18:42:00Z")

</div>

Hi @mpn17,

I believe creating a scripted field on an index pattern is what you're looking for to solve this. You can find the documentation here: [https://www.elastic.co/guide/en/kibana/current/scripted-fields.html](https://www.elastic.co/guide/en/kibana/current/scripted-fields.html).

---

<div class="post-metadata">

**Author:** ![mpn17](https://avatars.discourse-cdn.com/v4/letter/m/b487fb/32.png) [@mpn17](https://discuss.elastic.co/u/mpn17)\
**Post date:** [June 22, 2020, 7:22pm UTC](https://discuss.elastic.co/t/custom-derived-metric/235625/3 "2020-06-22T19:22:07Z")

</div>

@mikecote Thanks for the response. I noticed for scripted fields you can only access a single document at a time, albeit multiple fields. Additionally I was reading that metricbeat stores multiple metrics inside of a single event in a nested JSON document. So for example if I had the AWS module enabled, and was pulling metrics from the "cloudwatch" metricset, would it store all the metrics collected from that metricset in a single nested JSON document? In turn would I then be able to use scripted fields to access multiple metrics considering it would all be in a single document?

Thanks again!

---

<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:** [July 17, 2020, 1:54pm UTC](https://discuss.elastic.co/t/custom-derived-metric/235625/4 "2020-07-17T13:54:18Z")

</div>

Hi @mpn17,

I believe this would be doable within the metric visualization builder. You should be able to accomplish this by using some of the features like; filters, aggregation and split groups.

 ![Screen Shot 2020-07-17 at 9.51.19 AM](https://us1.discourse-cdn.com/elastic/original/3X/c/2/c276bf9dd8408fa55dbc5189e77d6f67da656322.png)

---

<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:** [August 14, 2020, 1:54pm UTC](https://discuss.elastic.co/t/custom-derived-metric/235625/5 "2020-08-14T13:54:45Z")

</div>

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