Commit graph

6 commits

Author SHA1 Message Date
OpenShift Merge Robot 4b80517b6a
Merge pull request #2522 from mheon/fix_timestamp_format_logs
Change timestamp format for podman logs
2019-03-04 13:52:21 -08:00
Matthew Heon 29ade7f6af Change timestamp format for podman logs
The Golang standard library implementation of RFC3339Nano will
trim trailing 0s from the nanoseconds portion of timestamps. This
is undesirable for lining everything up nicely during terminal
output. As the Golang developers have not seen fit to give us a
better way, use the one that was proposed on the issue tracker
but rejected.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-03-04 13:43:04 -05:00
Matthew Heon ff609a5ade Add additional defense against 0-length log segfaults
Signed-off-by: Matthew Heon <mheon@redhat.com>
2019-03-03 23:30:45 -05:00
Matthew Heon 429f2e63a0 When logging with timestamps, append only until newline
When we log time timestamps, don't print a new timestamp for each
input - instead, print one at the start of every line, and then
wait until we hit a newline to print a new timestamp.

This still doesn't exactly mirror the Docker behavior (they don't
print until they receive an entire line, while we print any time
the logs file is appended to - so you can see partial lines being
typed in our system). Also, timestamps are recorded as the start
of a line being typed, as opposed to when the enter key is
pressed (on Docker).

(Worth noting that, while characters are printed as they are
typed, logs does respect the backspace key - so you'll also see
them disappear as the person typing realizes they've made a
mistake and retypes their command).

This is the closest we can get to Docker without major surgery on
the Kubernetes log-printing library, so I'm content to call this
an adequate solution.

Signed-off-by: Matthew Heon <mheon@redhat.com>
2019-03-03 23:06:32 -05:00
Matthew Heon e372837eb0 Ensure that each log line is newline-terminated
When writing logs with timestamps to the terminal, ensure that
each line is newline-terminated, so we don't end up with an
unreadable mess with timestamps interspersed with the actual
content being displayed.

Signed-off-by: Matthew Heon <mheon@redhat.com>
2019-03-03 21:13:49 -05:00
umohnani8 7ffb8a7900 Add CRI logs parsing to podman logs
Podman logs was not parsing CRI logs well, especially
the F and P logs. Now using the same parsing code as
in kube here.

Signed-off-by: umohnani8 <umohnani@redhat.com>

Closes: #1403
Approved by: rhatdan
2018-09-05 13:48:20 +00:00