Rename by Regex

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

  • What are you trying to achieve?
    In the “Time Series” visualisation, change the Series names shown in the Legend to Alias and Tag combination.

  • How are you trying to achieve it?
    Data is stored in Influx 1.8, using InfluxQL , i want to rename the Series Names shown in the Legend and Tooltip. Ive attempted unsuccessfully to use the Rename by Regex transform, but i really dont understand the regex.

  • What happened?
    Nothing really…

  • What did you expect to happen?
    Magically the info shown will be correct and exactly what i want :wink:

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

The transforms i was playing with:

The current visualisation:

What i would like each series to look like:
Pooled - 3_PROD_Win10(obfuscated)
or Ded - 3_PROD_Win10(obfuscated)

this is basically just a combination of tags “Type” - “DG”
( i realise the values for my would actually be P or D - i can change the collection script to send Pooled and Ded instead… but if there is another rename/substition that would be cool too!)

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

  • Did you follow any online instructions? If so, what is the URL?
    Just a few google resuls eg: How to use "Rename by regex"

Hi @gregl ,
Try with this regex:



$1 $2


Regex breakdown:
LogOnStats\. - this matches literal string LogOnStats.
(\S+) - this is 1st capturing group. It extracts everything till first whitespace.
\s{ - this is space and literal {
([^:]*) - this is 2nd capturing group. It extracts string(s) till : (colon) symbol
.* - matches everything till end

Here is link to Regex101 where you can practice regex extraction and see if it works. Also take a look at this post where you can find more examples (note that there are few more link to other threads on the bottom of the post).


Best regrads,

You can define name directly (so you won’t need rename later) in ALIAS config (not alias function on the field). You can use any string, but also tag value or any string, tag combination there.

Thank you so much Idrascic - your answer was very close to what i needed, and with the help of Regex101 site, i was able to manipulate it to get it to where i needed it…so learned a lot too!. :beer: