Skip to content

Commit

Permalink
Search in all logs, not only last line
Browse files Browse the repository at this point in the history
  • Loading branch information
nikup committed Dec 29, 2023
1 parent 17cecdd commit 76c605e
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 14 deletions.
2 changes: 1 addition & 1 deletion controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ func (c *Controller) handlePod(pod *v1.Pod) error {
return err
}

if isIgnoredErrorForPod(pod.Name, lastNonEmptyLogLine(containerLogs)) {
if isIgnoredErrorForPod(pod.Name, containerLogs) {
continue
}

Expand Down
13 changes: 0 additions & 13 deletions helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,19 +88,6 @@ func isIgnoredErrorForPod(podName string, errorLog string) bool {
return false
}

func lastNonEmptyLogLine(logs string) string {
logLines := strings.Split(logs, "\n")

for i := 1; i <= len(logLines); i++ {
lastLogLine := logLines[len(logLines)-i]
if lastLogLine != "" {
return lastLogLine;
}
}

return ""
}

func isWatchedNamespace(namespace string) bool {
watchedNamespacesEnv := os.Getenv("WATCHED_NAMESPACES")
if watchedNamespacesEnv == "" {
Expand Down

0 comments on commit 76c605e

Please sign in to comment.