A bit more context would be helpful. Did you write:

matchers:
  - applicationid=~"^SNSVC\d{7}$"

or something else?

Testing with alertmanager 0.27, I think the problem is around handling of 
the backslash. The following is accepted by amtool check-config:

matchers:
  - applicationid=~"^SNSVC\\d{7}$"

but I've not checked if it matches as expected - you don't want to match a 
literal backslash and d!

This is also what the "suggestion" was telling you from the error message, 
but then it's also having to escape things for logfmt logging, which means 
double-quotes are preceded by backslash, and backslashes are doubled. When 
it says:
suggestion="applicationid=~\"^SNSVC\\\\d{7}$\""
I think what it's actually suggesting is:
applicationid=~"^SNSVC\\d{7}$"

Unfortunately, YAML also has its own rules for backslashes. Because of this 
complexity, I avoid backslashes in regexps where possible, for example 
using [.] instead of \. to match a literal dot.  In your case, you could 
write:

matchers:
  - applicationid=~"^SNSVC[0-9]{7}$"

and there would be no ambiguity.

On Friday, 6 December 2024 at 09:58:28 UTC Chris Burke wrote:

> Can someone please help explain the following Alertmanager warning.
> I know it's trying to tell me that my value needs to be double-quoted, but 
> it already is, so I do not understand what it is complaining about.
> My config: applicationid=~"^SNSVC\d{7}$"
>
> Thanks for any help
>
> ts=2024-12-06T00:44:13.964Z caller=parse.go:176 level=warn 
> msg="Alertmanager is moving to a new parser for labels and matchers, and 
> this input is incompatible. Alertmanager has instead parsed the input using 
> the classic matchers parser as a fallback. To make this input compatible 
> with the UTF-8 matchers parser please make sure all regular expressions and 
> values are double-quoted. If you are still seeing this message please open 
> an issue." input="applicationid=~\"^SNSVC\\d{7}$\"" origin=config 
> err="15:29: \"^SNSVC\\d{7}$\": invalid input" 
> suggestion="applicationid=~\"^SNSVC\\\\d{7}$\""
>
>

-- 
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 prometheus-users+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/prometheus-users/6d216fe8-927f-449a-8d8b-aee1a61bc511n%40googlegroups.com.

Reply via email to