diff options
author | Matthew Heon <matthew.heon@pm.me> | 2021-11-12 09:52:28 -0500 |
---|---|---|
committer | Matthew Heon <matthew.heon@pm.me> | 2021-11-12 11:08:25 -0500 |
commit | 6d9b1e4b8e7f72981cabcf576a8771ff458c0385 (patch) | |
tree | 74db026c2b2ed47b6ca934fad26e12a08c0b4b7c /libpod | |
parent | 8b368b5e1bfbce3380a38078992429fed544c013 (diff) | |
download | podman-6d9b1e4b8e7f72981cabcf576a8771ff458c0385.tar.gz podman-6d9b1e4b8e7f72981cabcf576a8771ff458c0385.tar.bz2 podman-6d9b1e4b8e7f72981cabcf576a8771ff458c0385.zip |
Fix partial log line handling with journald log driver
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] https://github.com/containers/podman/pull/12274#issuecomment-967168173
Signed-off-by: Matthew Heon <matthew.heon@pm.me>
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/container_log_linux.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libpod/container_log_linux.go b/libpod/container_log_linux.go index 4029d0af7..b6b780bab 100644 --- a/libpod/container_log_linux.go +++ b/libpod/container_log_linux.go @@ -140,6 +140,7 @@ func (c *Container) readFromJournal(ctx context.Context, options *logs.LogOption doTail = false } lastReadCursor := "" + partial := "" for { select { case <-ctx.Done(): @@ -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 |