From 03b63befa247ac84b795a0ec8d5280196b8d570d Mon Sep 17 00:00:00 2001 From: Akhil Rane Date: Thu, 21 Dec 2023 08:59:13 -0800 Subject: [PATCH] fix: lowercase logs before running regex matching in LogAnalyzer (#794) Signed-off-by: Akhil Rane --- pkg/analyzer/log.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/analyzer/log.go b/pkg/analyzer/log.go index e0ea087657..2f6aa5b9b1 100644 --- a/pkg/analyzer/log.go +++ b/pkg/analyzer/log.go @@ -69,7 +69,7 @@ func (LogAnalyzer) Analyze(a common.Analyzer) ([]common.Result, error) { } else { rawlogs := string(podLogs) - if errorPattern.MatchString(rawlogs) { + if errorPattern.MatchString(strings.ToLower(rawlogs)) { failures = append(failures, common.Failure{ Text: printErrorLines(pod.Name, pod.Namespace, rawlogs, errorPattern), Sensitive: []common.Sensitive{ @@ -108,7 +108,7 @@ func printErrorLines(podName, namespace, logs string, errorPattern *regexp.Regex // Check each line for errors and print the lines containing errors for _, line := range logLines { - if errorPattern.MatchString(line) { + if errorPattern.MatchString(strings.ToLower(line)) { return line } }