How to use a InfluxDB-tag value in a grafana legend?

In Grafana, you can use alias patterns. There is a description of alias patterns at the bottom of the metrics tab:

enter image description here

In your case, in the Alias By field you would write $tag_machine.

Here is an InfluxDb example on the Grafana demo site that uses the Alias By field:

https://play.grafana.org/d/000000002/influxdb-templated?editPanel=1&orgId=1


If you are using InfluxDB with Flux query language, use the following in the Display Name

  • ${__field.labels}
  • ${__field.labels.<tag_name>}

or in some cases this might work

  • ${__field.labels.name}