Skip to content

Commit 79be08d

Browse files
authored
Update regex
1 parent 7f26fb9 commit 79be08d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pkg/translator/translator.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ func RemoveSysdigLabels(expr, excludeScope string) string {
88
if excludeScope != "" {
99
scope = scope + "|" + excludeScope
1010
}
11-
regex := regexp.MustCompile("(?:" + scope + ")" + "(?:=|=~|!=|!~)\\$[\\w_]*,")
11+
regex := regexp.MustCompile("(?:" + scope + ")" + "\\s*(?:=|=~|!=|!~)\\$[\\w_]*,")
1212
expr = regex.ReplaceAllString(expr, "")
13-
regex = regexp.MustCompile("(?:" + scope + ")" + "(?:=|=~|!=|!~)\"\",")
13+
regex = regexp.MustCompile("(?:" + scope + ")" + "\\s*(?:=|=~|!=|!~)\"[\\w_-]*\",")
1414
expr = regex.ReplaceAllString(expr, "")
15-
regex = regexp.MustCompile("(?:" + scope + ")" + "(?:=|=~|!=|!~)\\$[\\w_]*\\}")
15+
regex = regexp.MustCompile("(?:" + scope + ")" + "\\s*(?:=|=~|!=|!~)\\$[\\w_]*\\}")
1616
expr = regex.ReplaceAllString(expr, "}")
17-
regex = regexp.MustCompile("(?:" + scope + ")" + "(?:=|=~|!=|!~)\"\"}")
17+
regex = regexp.MustCompile("(?:" + scope + ")" + "\\s*(?:=|=~|!=|!~)\"[\\w_-]*\"}")
1818
expr = regex.ReplaceAllString(expr, "}")
1919
// Remove the sysdig aggregation
2020
aggregation := "kube_cluster_name|kube_namespace_name|kube_pod_name|kube_workload_name|kube_node_name|agent_tag_cluster"

0 commit comments

Comments
 (0)