# How to define mustache variable for Kibana TSVB time series label

**URL:** <https://discuss.elastic.co/t/how-to-define-mustache-variable-for-kibana-tsvb-time-series-label/246071>\
**Category:** Kibana\
**Created:** [August 24, 2020, 8:32am UTC](https://discuss.elastic.co/t/how-to-define-mustache-variable-for-kibana-tsvb-time-series-label/246071 "2020-08-24T08:32:03Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Roy\_Zhang](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/roy_zhang/32/67560_2.png) [@Roy\_Zhang](https://discuss.elastic.co/u/Roy_Zhang)\
**Post date:** [August 24, 2020, 8:32am UTC](https://discuss.elastic.co/t/how-to-define-mustache-variable-for-kibana-tsvb-time-series-label/246071/1 "2020-08-24T08:32:03Z")

</div>

Dear Kibana Experts,

According to [https://www.elastic.co/guide/en/kibana/master/TSVB.html](https://www.elastic.co/guide/en/kibana/master/TSVB.html), for "series that are grouped by a term, I need to specify a mustache variable of `{{key}}` to substitute the term" for labels.  
I am using metricBeat to streaming prometheus data to ELK, I'd like to use "prometheus.labels.instance \_process CPU Load" as my legend. I googled for a long time, didn't find solution, could u please kindly advice?

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/b/a/ba414c1419bf95f9e058be0387683cd026ed88e8.png)

Thanks in advance!

Thanks,  
Roy

---

<div class="post-metadata">

**Author:** ![wylie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wylie/32/81794_2.png) [@wylie](https://discuss.elastic.co/u/wylie)\
**Post date:** [August 24, 2020, 5:22pm UTC](https://discuss.elastic.co/t/how-to-define-mustache-variable-for-kibana-tsvb-time-series-label/246071/2 "2020-08-24T17:22:50Z")

</div>

You should be able to use the IP addresses as keys, if you substitute all the special characters for `_`. So `10_100_73_137_2046.label`

---

<div class="post-metadata">

**Author:** ![Roy\_Zhang](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/roy_zhang/32/67560_2.png) [@Roy\_Zhang](https://discuss.elastic.co/u/Roy_Zhang)\
**Post date:** [August 24, 2020, 11:57pm UTC](https://discuss.elastic.co/t/how-to-define-mustache-variable-for-kibana-tsvb-time-series-label/246071/3 "2020-08-24T23:57:56Z")

</div>

Thx @wylie for ur help!!! But:

1. I am using container, hence the IP is dynamically assigned, seems I can't use static IP as keys.
2. For this case, I using `10_100_73_137_2046.label` as key, but seems it doesn't work.

BTW, the variable for my IP is `prometheus.labels.instance`

Could u pls kindly advice? Thx in advance!!!

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/b/5/b534a709c1d5b26225eae50a00d34ecbcf06f5bb.png)

---

<div class="post-metadata">

**Author:** ![wylie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wylie/32/81794_2.png) [@wylie](https://discuss.elastic.co/u/wylie)\
**Post date:** [August 25, 2020, 2:25pm UTC](https://discuss.elastic.co/t/how-to-define-mustache-variable-for-kibana-tsvb-time-series-label/246071/4 "2020-08-25T14:25:59Z")

</div>

I don't think I understand your goal then. Can you explain?

---

<div class="post-metadata">

**Author:** ![Roy\_Zhang](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/roy_zhang/32/67560_2.png) [@Roy\_Zhang](https://discuss.elastic.co/u/Roy_Zhang)\
**Post date:** [August 26, 2020, 2:40am UTC](https://discuss.elastic.co/t/how-to-define-mustache-variable-for-kibana-tsvb-time-series-label/246071/5 "2020-08-26T02:40:15Z")

</div>

Dear @wylie,

I am using grouped by term (i.e, ip, variable is `prometheus.labels.instance`) to show each server's CPU Util, by default the label(legend) is IP address.  
My goal is to add suffix to every label, e.g, for `10.100.73.137:2046`, I want to show it as `10.100.73.137:2046_systemcpuload`, just like kibana line graph:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/1/b/1b6721327ac63806cef4e784fb02896631d12cb3.jpeg)

Hope it clarifies 🙂  
Thanks for ur help in advance!

**Whole context**  
In this graph, I want to show both `system cpu load` and `process cpu load` for every server. If the label is ip address, I can't distinguish `system cpu load` from `process cpu load`, hence I want to add suffix to IP address, e,g `10.100.73.137:2046_systemcpuload` && `10.100.73.137:2046_processcpuload`

Thanks,  
Roy

---

<div class="post-metadata">

**Author:** ![wylie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wylie/32/81794_2.png) [@wylie](https://discuss.elastic.co/u/wylie)\
**Post date:** [August 26, 2020, 3:00pm UTC](https://discuss.elastic.co/t/how-to-define-mustache-variable-for-kibana-tsvb-time-series-label/246071/6 "2020-08-26T15:00:38Z")

</div>

I understand the goal now. It looks like you've found a missing feature in TSVB, and I [created an issue](https://github.com/elastic/kibana/issues/75990) for it.

Your best workaround is one you've already found: use Visualize or Lens to create a second Y axis, and this will give your series a unique name.

---

<div class="post-metadata">

**Author:** ![Roy\_Zhang](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/roy_zhang/32/67560_2.png) [@Roy\_Zhang](https://discuss.elastic.co/u/Roy_Zhang)\
**Post date:** [August 27, 2020, 12:58am UTC](https://discuss.elastic.co/t/how-to-define-mustache-variable-for-kibana-tsvb-time-series-label/246071/7 "2020-08-27T00:58:33Z")

</div>

Thx dear @wylie!  
Hope we will have this feature in TSVB soon. TSVB is much better than Visualize 🙂

TSVB is one of reasons that I am using Kibana to replace Grafana as visualization solution:)

---

<div class="post-metadata">

**Author:** ![wylie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wylie/32/81794_2.png) [@wylie](https://discuss.elastic.co/u/wylie)\
**Post date:** [August 27, 2020, 4:18pm UTC](https://discuss.elastic.co/t/how-to-define-mustache-variable-for-kibana-tsvb-time-series-label/246071/8 "2020-08-27T16:18:45Z")

</div>

As one of the engineers who works on Lens, I hope you'll try it out too- it's meant to be easy to use.

---

<div class="post-metadata">

**Author:** ![Roy\_Zhang](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/roy_zhang/32/67560_2.png) [@Roy\_Zhang](https://discuss.elastic.co/u/Roy_Zhang)\
**Post date:** [August 28, 2020, 2:26am UTC](https://discuss.elastic.co/t/how-to-define-mustache-variable-for-kibana-tsvb-time-series-label/246071/9 "2020-08-28T02:26:49Z")

</div>

Thx @wylie!!! I will try Lens.  
BTW, I'd like to bring another question to u (Kibana expert:) , elastic API can support moving functions, but seems Kibana doesn't support moving functions (it only support moving average), do we have any work around? Does Lens support moving functions?

One of biggest problems of migrating from Grafana to Kibana is Kibana doesn't support moving functions.

Pls feel free to let me know that I need to create another topic 😄

---

<div class="post-metadata">

**Author:** ![wylie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wylie/32/81794_2.png) [@wylie](https://discuss.elastic.co/u/wylie)\
**Post date:** [August 31, 2020, 2:09pm UTC](https://discuss.elastic.co/t/how-to-define-mustache-variable-for-kibana-tsvb-time-series-label/246071/10 "2020-08-31T14:09:49Z")

</div>

It is generally best to ask one question per thread, but in this case there is a short answer: most Kibana visualizations support the basic moving functions, but not Lens yet. If you're missing a specific moving function, or seeing something else confusing, a separate post would be best.

---

<div class="post-metadata">

**Author:** ![Roy\_Zhang](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/roy_zhang/32/67560_2.png) [@Roy\_Zhang](https://discuss.elastic.co/u/Roy_Zhang)\
**Post date:** [August 31, 2020, 3:50pm UTC](https://discuss.elastic.co/t/how-to-define-mustache-variable-for-kibana-tsvb-time-series-label/246071/11 "2020-08-31T15:50:54Z")

</div>

Thx @wylie!

---

<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:** [September 28, 2020, 3:50pm UTC](https://discuss.elastic.co/t/how-to-define-mustache-variable-for-kibana-tsvb-time-series-label/246071/12 "2020-09-28T15:50:55Z")

</div>

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