Skip to content

Commit

Permalink
Fix partial log line handling with journald log driver
Browse files Browse the repository at this point in the history
Patch originally by Paul Holzinger (sourced from [1]).

This is necessary to get the tests to pass in order to include a
batch of other, related journald fixes in `podman logs`.

[1] #12274 (comment)

Signed-off-by: Matthew Heon <[email protected]>
  • Loading branch information
mheon committed Nov 12, 2021
1 parent 8b368b5 commit 6d9b1e4
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions libpod/container_log_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ func (c *Container) readFromJournal(ctx context.Context, options *logs.LogOption
doTail = false
}
lastReadCursor := ""
partial := ""
for {
select {
case <-ctx.Done():
Expand Down Expand Up @@ -229,6 +230,12 @@ func (c *Container) readFromJournal(ctx context.Context, options *logs.LogOption
logrus.Errorf("Failed parse log line: %v", err)
return
}
if logLine.Partial() {
partial += logLine.Msg
continue
}
logLine.Msg = partial + logLine.Msg
partial = ""
if doTail {
tailQueue = append(tailQueue, logLine)
continue
Expand Down

0 comments on commit 6d9b1e4

Please sign in to comment.