Skip to content

Commit 0c52ffe

Browse files
committed
make local copy of JSONLog
Signed-off-by: Davanum Srinivas <[email protected]>
1 parent 307bafb commit 0c52ffe

File tree

1 file changed

+13
-3
lines changed
  • pkg/kubelet/kuberuntime/logs

1 file changed

+13
-3
lines changed

pkg/kubelet/kuberuntime/logs/logs.go

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ import (
2929
"path/filepath"
3030
"time"
3131

32-
"github.com/docker/docker/daemon/logger/jsonfilelog/jsonlog"
3332
"github.com/fsnotify/fsnotify"
3433
"k8s.io/klog"
3534

@@ -165,13 +164,24 @@ func parseCRILog(log []byte, msg *logMessage) error {
165164
return nil
166165
}
167166

167+
// jsonLog is a log message, typically a single entry from a given log stream.
168+
// since the data structure is originally from docker, we should be careful to
169+
// with any changes to jsonLog
170+
type jsonLog struct {
171+
// Log is the log message
172+
Log string `json:"log,omitempty"`
173+
// Stream is the log source
174+
Stream string `json:"stream,omitempty"`
175+
// Created is the created timestamp of log
176+
Created time.Time `json:"time"`
177+
}
178+
168179
// parseDockerJSONLog parses logs in Docker JSON log format. Docker JSON log format
169180
// example:
170181
// {"log":"content 1","stream":"stdout","time":"2016-10-20T18:39:20.57606443Z"}
171182
// {"log":"content 2","stream":"stderr","time":"2016-10-20T18:39:20.57606444Z"}
172183
func parseDockerJSONLog(log []byte, msg *logMessage) error {
173-
var l = &jsonlog.JSONLog{}
174-
l.Reset()
184+
var l = &jsonLog{}
175185

176186
// TODO: JSON decoding is fairly expensive, we should evaluate this.
177187
if err := json.Unmarshal(log, l); err != nil {

0 commit comments

Comments
 (0)