Skip to content

Commit e62be1a

Browse files
committed
fix: Check log line length before trimming
Some lines seems to be invalid. `docker logs` seems to just discard them, so we'll do something similar.
1 parent a6647e0 commit e62be1a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

stern/docker_tail.go

+6
Original file line numberDiff line numberDiff line change
@@ -232,5 +232,11 @@ func trimLeadingChars(line string, tty bool) string {
232232
if tty {
233233
return line
234234
}
235+
if len(line) < 8 {
236+
// And sometimes the line is something else...?
237+
klog.V(7).InfoS("Invalid log line format received", "line", line)
238+
return ""
239+
}
240+
235241
return line[8:]
236242
}

0 commit comments

Comments
 (0)