Go regexes unfortunately do not support negative matches. I believe you can
get the behavior that you need by having a temporary label, and changing it
based on the various conditions:

1. you want to keep all metrics by default (action replace, target
__tmp_keep, replacement "yes")
2. you want to drop all unit state metrics (action replace, source labels
__name__, match "node_systemd_unit_state", target __tmp_keep, replacement
"no")
3. you want to keep all unit state metrics where name matches (action
replace, source labels [__name__,name], match
"node_systemd_unit_state;(mysql|postrgresql).*", target __tmp_keep,
replacement yes)
4. act on the temporary label (action keep, source labels _tmp_keep, match
"yes")

/MR

On Fri, Nov 20, 2020 at 10:24 AM Emre Kiratli <[email protected]> wrote:

> ^((?!.*myspecificservice.*).)*$  does not work
>
> prom log :
>
> err="parsing YAML file /etc/config/prometheus.yml: error parsing regexp:
> invalid or unsupported Perl syntax: `(?!`"
>
> 20 Kasım 2020 Cuma tarihinde saat 13:20:18 UTC+3 itibarıyla Emre Kiratli
> şunları yazdı:
>
>> https://github.com/prometheus/prometheus/issues/3092
>>
>> This is my current issue i just want to watch mysql,postgresql labels and
>> drop the rest. Did anyone figure this out?
>>
> --
> 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/34494ea5-a7c3-41a5-8425-3848d4bb0f12n%40googlegroups.com
> <https://groups.google.com/d/msgid/prometheus-users/34494ea5-a7c3-41a5-8425-3848d4bb0f12n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CAMV%3D_gYT3wDcMR8YBvFt8ZHFJdVe5_nLB--hRF3a4JXijptjpw%40mail.gmail.com.

Reply via email to