In case the proposed "template" relabeling action in https://github.com/prometheus/prometheus/issues/9637#issuecomment-970327987 makes it into Prometheus, it's conceivable that there could be various functions that are made available to the template code that could e.g. include lower-casing.
On Tue, Nov 23, 2021 at 2:31 PM Brian Candler <[email protected]> wrote: > 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 > <https://groups.google.com/d/msgid/prometheus-users/c6cc019c-fea3-46a0-9a0d-5ea144a71ea3n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- Julius Volz PromLabs - promlabs.com -- 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/CAObpH5yG_RoBWfm_iX8mM4V3KU5A5aepHh-_i9JvdxNjEWZVWQ%40mail.gmail.com.

