Semicolons are inserted between the source_labels. so you need:

regex: istio_requests_total;

I think it's clearer if you quote it:

regex: "istio_requests_total;"

On Saturday, 24 June 2023 at 15:59:58 UTC David B G. wrote:

> Hello Brian, Thank you for you answer I really appreciate it
>
> I followed your steps specifically in:
>
>
> * 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.  *
>
>  I have achieved a temporal keep but I dont know how can I relabel only 
> the ones  that dont have /good1 or /good2 because there are a lot of path 
> and always changing, I was trying something like this 
>
>
> - source_labels: [__name__,request_path]
>   regex: istio_requests_total;(/good1|/good2)
>   replacement: true
>   target_label: __tmp_keep
> - source_labels: [__name__,__tmp_keep]
>   regex: istio_requests_total
>   replacement: /dummy
>   target_label: request_path
>
> But I dont know how to work with the tmp_keep to say for example replace 
> when the path is different of /good1 or /good2
>
>
> Tahnk you very much 
>
>
> El sábado, 24 de junio de 2023 a las 1:34:54 UTC-6, Brian Candler escribió:
>
>> 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/61c0dff7-2c50-411b-aaf2-188ffc9588f7n%40googlegroups.com.

Reply via email to