Regex in prometheus templating

Hi everyone,

I’m trying to create a template variable with prometheus as a datasource. My problem is that I want to use a values the result of concatenating two prometheus tags. For example:

given this result
up{application=“xx”,environment=“test”,job=“NodeExporter”,server=“server-yy”},
to have this value
xx server-yy (application server)

image

that query returns the following result.
up{application=“xx”,environment=“test”,job=“NodeExporter”,server=“server-yy”}
up{application=“xx”,environment=“test”,job=“NodeExporter”,server=“server-yx”}

What I’ve done other times is write a regex like this: .*server=“(.*?)”.* and the values would be the value of the tag server for each result.
I’ve tried to change the regex to something like this .*application=“(.*?)”.*server=“(.*?)”.* but the result is only the application. Can someone please help me with this?

Thanks in advance