AFAIK this isn't possible. The things you *can* do with label_replace are given here: https://prometheus.io/docs/prometheus/latest/querying/functions/#label_replace The replacement value is just a string which can have $1, $2 etc in it.
On Tuesday, 23 November 2021 at 08:19:54 UTC [email protected] wrote: > Hello, > > I need to lowercase the hostname of my metrics. > > I would like to use the function label_replace as below. The idea here is > to create a new field called "host" that forces the lowercase of the > "hostname "field. Is it possible to use the regex (here "[[LOWER]]") to do > this ? > > sum without (hostname) (label_replace(up{instance="x.x.x.x:9100"} * on > (instance) group_left(hostname) sophosav_linux_started, "host", "${1}", > "hostname", "[[LOWER]]")) > > Thanks for your answer > -- You received this message because you are subscribed to the Google Groups "Prometheus Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/c6cc019c-fea3-46a0-9a0d-5ea144a71ea3n%40googlegroups.com.

