Skip to content

Commit

Permalink
fix: lowercase logs before running regex matching in LogAnalyzer (#794)
Browse files Browse the repository at this point in the history
Signed-off-by: Akhil Rane <akhil131192@gmail.com>
  • Loading branch information
akhil-rane committed Dec 21, 2023
1 parent 3c6c759 commit 03b63be
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/analyzer/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down Expand Up @@ -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
}
}
Expand Down

0 comments on commit 03b63be

Please sign in to comment.