@@ -29,7 +29,6 @@ import (
29
29
"path/filepath"
30
30
"time"
31
31
32
- "github.com/docker/docker/daemon/logger/jsonfilelog/jsonlog"
33
32
"github.com/fsnotify/fsnotify"
34
33
"k8s.io/klog"
35
34
@@ -165,13 +164,24 @@ func parseCRILog(log []byte, msg *logMessage) error {
165
164
return nil
166
165
}
167
166
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
+
168
179
// parseDockerJSONLog parses logs in Docker JSON log format. Docker JSON log format
169
180
// example:
170
181
// {"log":"content 1","stream":"stdout","time":"2016-10-20T18:39:20.57606443Z"}
171
182
// {"log":"content 2","stream":"stderr","time":"2016-10-20T18:39:20.57606444Z"}
172
183
func parseDockerJSONLog (log []byte , msg * logMessage ) error {
173
- var l = & jsonlog.JSONLog {}
174
- l .Reset ()
184
+ var l = & jsonLog {}
175
185
176
186
// TODO: JSON decoding is fairly expensive, we should evaluate this.
177
187
if err := json .Unmarshal (log , l ); err != nil {
0 commit comments