How to remove a prefix from the datasource variable

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

  • Grafana v7.5.17

  • What are you trying to achieve?

  • Create a variable to use in dashboard by trimming a prefix from another variable. There is a datasource variable which have values like X3-region1, X3-region2, X3-region3 etc. I want to create another variable which has values like region1, region2, region3 etc. How can I remove the X3 prefix from the first variable and use the values

  • How are you trying to achieve it?

  • Clone the existing variable and apply some regex to remove the prefix from the values

  • What happened?
    I do not find a way to modify the values of the variable

  • What did you expect to happen?

  • Apply regex on the variable values and modify it to use in another variable

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

  • 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?

what is the datasource of the first variable?

It’s a custom in-house datasource. Is there a way I can use the first variable value after trimming the first 3 characters in the query instead of creating a new variable?