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
@@ -6,6 +6,7 @@ package journald // import "github.com/docker/docker/daemon/logger/journald"
import (
"fmt"
+ "strconv"
"sync"
"unicode"
@@ -105,9 +106,14 @@ func (s *journald) Log(msg *logger.Message) error {
for k, v := range s.vars {
vars[k] = v
}
- if msg.PLogMetaData != nil && !msg.PLogMetaData.Last {
+ 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)
source := msg.Source
