mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-15 00:13:30 +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 {
|
||||
regex := *rc.Regex
|
||||
if rc.Action != "replace_all" && rc.Action != "labelmap_all" {
|
||||
regex = "^" + *rc.Regex + "$"
|
||||
regex = "^(?:" + *rc.Regex + ")$"
|
||||
}
|
||||
re, err := regexp.Compile(regex)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user