mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
add partial metadata to journald logs
add all partial metadata available to journald logs to allow easier reassembly of partial messages in downstream logging systems fixes #41403 Signed-off-by: Christian Becker <christian.becker@sixt.com>
This commit is contained in:
parent
7ae5222c72
commit
322c9e6866
1 changed files with 8 additions and 2 deletions
|
@ -6,6 +6,7 @@ package journald // import "github.com/docker/docker/daemon/logger/journald"
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
"sync"
|
||||
"unicode"
|
||||
|
||||
|
@ -105,8 +106,13 @@ func (s *journald) Log(msg *logger.Message) error {
|
|||
for k, v := range s.vars {
|
||||
vars[k] = v
|
||||
}
|
||||
if msg.PLogMetaData != nil && !msg.PLogMetaData.Last {
|
||||
vars["CONTAINER_PARTIAL_MESSAGE"] = "true"
|
||||
if msg.PLogMetaData != nil {
|
||||
vars["CONTAINER_PARTIAL_ID"] = msg.PLogMetaData.ID
|
||||
vars["CONTAINER_PARTIAL_ORDINAL"] = strconv.Itoa(msg.PLogMetaData.Ordinal)
|
||||
vars["CONTAINER_PARTIAL_LAST"] = strconv.FormatBool(msg.PLogMetaData.Last)
|
||||
if !msg.PLogMetaData.Last {
|
||||
vars["CONTAINER_PARTIAL_MESSAGE"] = "true"
|
||||
}
|
||||
}
|
||||
|
||||
line := string(msg.Line)
|
||||
|
|
Loading…
Reference in a new issue