Map regex groups to friendly names in query variable?

Our instance is a machine name which follows strict rules, e.g. all instances end like “-XY01”. I want to have a template variable which uses the values of <X>, which I can do with a regex such as /-(\w)\w\d+$/ but this just gives me that one character.
We have a mapping for <X> e.g. L=Live T=Test S=Special so in my variable drop-down I want to show these words, not just the one letter.
Is this something I can do either in Prometheus relabel, or preferable in Grafana query regex?

I found that there is some related functionality, but it’s beyond my regex skills to figure out how/if I can use it do do this sort of mapping: Filter variables with regex | Grafana Labs

This topic was automatically closed after 365 days. New replies are no longer allowed.