mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-15 16:30:55 +01:00
lib/promrelabel: properly apply ^
and $
anchors to regex
value in Prometheus relabeling rules
This commit is contained in:
parent
a586b8b6d4
commit
aad38c8283
@ -63,7 +63,7 @@ func parseRelabelConfig(dst []ParsedRelabelConfig, rc *RelabelConfig) ([]ParsedR
|
|||||||
if rc.Regex != nil {
|
if rc.Regex != nil {
|
||||||
regex := *rc.Regex
|
regex := *rc.Regex
|
||||||
if rc.Action != "replace_all" && rc.Action != "labelmap_all" {
|
if rc.Action != "replace_all" && rc.Action != "labelmap_all" {
|
||||||
regex = "^" + *rc.Regex + "$"
|
regex = "^(?:" + *rc.Regex + ")$"
|
||||||
}
|
}
|
||||||
re, err := regexp.Compile(regex)
|
re, err := regexp.Compile(regex)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user