Skip to content

Commit 44500c4

Browse files
craig[bot]aa-joshi
andcommitted
Merge #152973
152973: util/log: skip malformed log entries while reading from file r=aa-joshi a=aa-joshi Previously, readAllEntriesFromFile was returning an error if the log file contains the malformed log entry. The malformed log entry primarily could be the unexpected panic log. This would result in failure in fetching the logs from file. This was inadequate because single log line can cause failure in reading rest of the logs which are with valid format. To address this, this patch skips the malformed log entries during decode and only valid log lines are returned. Fixes: #149866 Informs: #151493 Release note: None Co-authored-by: Akshay Joshi <[email protected]>
2 parents fa76ba1 + 64196a7 commit 44500c4

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pkg/util/log/file_api.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,13 @@ func readAllEntriesFromFile(
429429
if err == io.EOF {
430430
break
431431
}
432+
433+
// skip the malformed log entry. This is primarily observed in the
434+
// panic which is unstructured.
435+
// See: https://github.com/cockroachdb/cockroach/issues/151493
436+
if errors.Is(err, ErrMalformedLogEntry) {
437+
continue
438+
}
432439
return nil, false, err
433440
}
434441
var match bool

0 commit comments

Comments
 (0)