Skip to content

Commit a58c8ba

Browse files
authored
Skipped malformed docker-compose log lines (#1297)
1 parent a28f696 commit a58c8ba

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

internal/stack/parselogs.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ package stack
77
import (
88
"bufio"
99
"encoding/json"
10-
"fmt"
1110
"os"
1211
"strings"
1312
"time"
13+
14+
"github.com/elastic/elastic-package/internal/logger"
1415
)
1516

1617
type ParseLogsOptions struct {
@@ -41,7 +42,8 @@ func ParseLogs(options ParseLogsOptions, process func(log LogLine) error) error
4142
messageSlice := strings.SplitN(line, "|", 2)
4243

4344
if len(messageSlice) != 2 {
44-
return fmt.Errorf("malformed docker-compose log line")
45+
logger.Debugf("skipped malformed docker-compose log line: %s", line)
46+
continue
4547
}
4648

4749
messageLog := messageSlice[1]
@@ -54,6 +56,8 @@ func ParseLogs(options ParseLogsOptions, process func(log LogLine) error) error
5456
}
5557

5658
// There could be valid messages with just plain text without timestamp
59+
// and therefore not processed, cannot be ensured in which timestamp they
60+
// were generated
5761
if !startProcessing && log.Timestamp.Before(options.StartTime) {
5862
continue
5963
}

0 commit comments

Comments
 (0)