Skip to content

Commit

Permalink
fix log level parsing. skip java stacktrace noise
Browse files Browse the repository at this point in the history
  • Loading branch information
abuchanan-airbyte committed Sep 10, 2024
1 parent d3b312b commit 7fcf0c7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion internal/cmd/local/local/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ func (c *Command) watchEvents(ctx context.Context) {
}

// 2024-09-10 20:16:24 WARN i.m.s.r.u.Loggers$Slf4JLogger(warn):299 - [273....
var javaLogRx = regexp.MustCompile(`^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} \x1b\[\d+m(?P<level>[A-Z]+)\x1b\[m (?P<msg>\S+ - .*)`)
var javaLogRx = regexp.MustCompile(`^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} \x1b\[(?:1;)?\d+m(?P<level>[A-Z]+)\x1b\[m (?P<msg>\S+ - .*)`)

func (c *Command) streamPodLogs(ctx context.Context, namespace, podName, prefix string, since time.Time) error {
r, err := c.k8s.StreamPodLogs(ctx, airbyteNamespace, airbyteBootloaderPodName, since)
Expand All @@ -394,6 +394,12 @@ func (c *Command) streamPodLogs(ctx context.Context, namespace, podName, prefix
scanner := bufio.NewScanner(r)

for scanner.Scan() {

// skip java stacktrace noise
if strings.HasPrefix(scanner.Text(), "\tat ") || strings.HasPrefix(scanner.Text(), "\t... ") {
continue
}

m := javaLogRx.FindSubmatch(scanner.Bytes())
var msg string

Expand Down

0 comments on commit 7fcf0c7

Please sign in to comment.