On 10/11/2020 14:32, [email protected] wrote:
Hi,
I have a query with promql. I have prom sd configuration to scrape
metrics from my kube cluster. I want to know if it is possible to cut
string and apply it as label name.
My project has test01, test02 and preprod environments but namespaces
will be test01-internal, test02-internal, prodref-internal and
prodref-external .Because of prometheus sd config the env is coming as
test01-internal where i want only test01. Is it possible to extract
only this string and using replace i can send this as env label.
Yes you can do that with relabeling.
Use a regular expression match, with a () around the bit you want to
keep. That will then be stored in $1, which is the default already for
the "replacement:" field.
https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config
--
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/ef42fa58-c41d-9bc3-0119-aa4656d4ce5b%40Jahingo.com.