Remove the start-of-line marker (^) and match any single character (.) from the middle of your regex. As-is, it can't possibly match. Try instead:
*regex: istio_requests_total;(/bad1|/bad2)* Prometheus implicitly anchors the entire regex, so in effect your regex matches the same as *^(istio_requests_total;(/bad1|/bad2))$* This also means it will only match exactly /bad1 and /bad2, not paths starting with /bad1 or /bad2. If you want the latter, then you must explicitly match additional characters after it: *regex: istio_requests_total;(/bad1|/bad2).** If instead you want to match all paths *except* /good1 and /good2 then you need two steps: one to set a temporary "keep" label for these, and then relabel only those which don't have it. This has been asked and answered recently: https://groups.google.com/g/prometheus-users/c/gy510HjV-Sw https://groups.google.com/g/prometheus-users/c/eyTPBaadDOU On Saturday, 24 June 2023 at 02:14:52 UTC David B G. wrote: > Hello Prometheus community, Could you please help me about a I doubt I > have in the realabeling usage, I am trying to do an not equal rule to > change the path of one value for example I have the following information > object labels: > > > *__name__: "istio_requests_total"request_path: "/bad1"* > > and I what I am trying is to replace if the request_path is distinct to > good1 or good2 to change to /dummy path. > > Here is my relabeling rule: > > > > > > *- source_labels: [__name__,request_path] regex: > istio_requests_total;^.(/good1|/good2) action: replace replacement: > /dummy target_label: request_path* > > > This rule doesn’t seems to work and I don’t know if it is a way to say for > example if not equal too good1 or good2 change the path /dummy. > > Thank you all for your help. > > > -- 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/7b8db422-0156-4187-8a94-2d432fcefb5bn%40googlegroups.com.

