Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Grafana dashboard variable in another variables regex?

I created a Grafana dashboard variable and tried to filter the values via the regex field. This works for static regex definition.

I would now like to use another variable inside the regex which provides the regex value.

So the regex field should look somehow like: /$theRealRegexVar/

I tried it with many different versions like /${theRealRegexVar}/ or /[[theRealRegexVar]]/ but it seems not to work.

Does it work somehow or is it simply impossible?

Update

The datasource is prometheus.

The regex would be a regex ;-) (for example "^.*$" - however the user would provide it in the other variable)

like image 398
eventhorizon Avatar asked Nov 17 '22 16:11

eventhorizon


1 Answers

Can I ask on the same subject if you can use a a variable in a regex for the next linked variable and so on.

So var1 is set var2 runs the query but to limit results in the regex you use var1. Something like this: /csm-e-${var1}.*/

like image 108
Kobus Avatar answered Dec 20 '22 18:12

Kobus