On 24 Feb 15:03, Steve wrote:
> Hi
> labeldrop is straightforward when you know the label to drop.
> What if the labels are not known or the list is too long?
> 
> For instance. 
> After relabel_configs, I have the following labels in my timeseries:
> - job
> - instance
> - pod_name
> - namespace
> 
> What should be the metric_relabel_configs to drop all other labels?
> Does regex support negative matches?
> 
> Thank you
> 
> -Steve

You can use labelkeep.

- regex: "(job|instance|pod_name|namespace)"
  action: labelkeep

Note, as per doc:
Care must be taken with labeldrop and labelkeep to ensure that metrics
are still uniquely labeled once the labels are removed.

> 
> 
> -- 
> 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/506ab0cf-8a0b-4ebb-b5ab-ead424ad220e%40googlegroups.com.


-- 
 (o-    Julien Pivotto
 //\    Open-Source Consultant
 V_/_   Inuits - https://www.inuits.eu

-- 
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/20200224230622.GA17942%40oxygen.

Attachment: signature.asc
Description: PGP signature

Reply via email to