Display name overrides with Regex not working

  • What Grafana version and what operating system are you using?

Grafana Cloud

  • What are you trying to achieve?

I’m trying to override display names with a matching regex. This is what I’m trying to achieve:

${host} Temp[0] → Sensor 1
${host} Temp[1] → Sensor 2

  • How are you trying to achieve it?

I tried a name override, which works fine. However, the variable ${host} changes, e.g. “host1”, “host2”, so a name override is not possible. I think I need to use a regex override, but what I did does not have any effect.

  • What happened?

Nothing, the override doesn’t work.

  • What did you expect to happen?

Change of name from “${host} Temp[0]” to “Sensor 1”.

  • Can you copy/paste the configuration(s) that you are having problems with?

See image above.

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.

No.

  • Did you follow any online instructions? If so, what is the URL?
1 Like

I have the same issue and don’t know how to fix it.

Maybe you must try with the host name included in regex, like “host1 Temp[0]”.

I had this problems yesterday and i solved with a regex that contains all possibilities. In my problem I would like to math all status 400 and my entries was “POST Status 404”, “GET Status 403”, etc… So I first try this regex “Status 40[0-9]” but it doesn’t seem to work so I try with all possibilities in regex like this “GET|POST Status 40[0-9]”.

I hope this can helps you

Guessing you probably have to escape those brackets with something like Temp\[0\] . Additionally, I tend to have good results wildcarding things with .* such that I think this will work with something like .*Temp\[0\].*

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