Groups
Sign in
Groups
Prometheus Users
Conversations
About
Send feedback
Help
Regexp match in template
19 views
Skip to first unread message
fiala...@gmail.com
unread,
Jun 28, 2024, 5:49:00 AM (9 days ago)
Jun 28
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Prometheus Users
Hi,
is it possible to make a regexp match in annotation?
I need to check, if label contains specific string.
function "regexMatch" not defined
Thank you.
Brian Candler
unread,
Jun 28, 2024, 9:59:48 AM (9 days ago)
Jun 28
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Prometheus Users
See the template functions listed here:
https://prometheus.io/docs/prometheus/latest/configuration/template_reference/#strings
There is one called "match" which matches regular expressions. (Note that there is not one called "regexMatch")
You should also be able to use the go template global functions:
https://pkg.go.dev/text/template#hdr-Functions
If this is for alerts, it might be simpler to use routing rules, with two different alert receivers.
Reply all
Reply to author
Forward
0 new messages