From 64271a2aa3c430e50280a0685ac082375236b88e Mon Sep 17 00:00:00 2001 From: James Turnbull Date: Sat, 10 May 2014 18:51:16 +0200 Subject: [PATCH] Updated docker logs timestamp to RFC3339 Currently the docker logs timestamp flag generates log entries like: $ sudo docker logs -ft daemon_dave [May 10 13:06:17.934] hello world It uses Go's StampMilli timestamp to generate the timestamp. The entry is also wrapped in [ ]. This is non-standard operational timestamp and one that will require custom parsing. The new timestamp is RFC3999Nano and generates entries like: 2014-05-10T17:42:14.999999999Z07:00 hello world These are readily parsed by tools like ELK. Docker-DCO-1.1-Signed-off-by: James Turnbull (github: jamtur01) Docker-DCO-1.1-Signed-off-by: Tibor Vass (github: tiborvass) --- docs/sources/reference/commandline/cli.md | 24 +++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/docs/sources/reference/commandline/cli.md b/docs/sources/reference/commandline/cli.md index 9a6d27f0eb..182eb2a221 100644 --- a/docs/sources/reference/commandline/cli.md +++ b/docs/sources/reference/commandline/cli.md @@ -425,24 +425,24 @@ You'll need two shells for this example. **Shell 1: (Again .. now showing events):** - [2013-09-03 15:49:26 +0200 CEST] 4386fb97867d: (from 12de384bfb10) start - [2013-09-03 15:49:29 +0200 CEST] 4386fb97867d: (from 12de384bfb10) die - [2013-09-03 15:49:29 +0200 CEST] 4386fb97867d: (from 12de384bfb10) stop + 2014-05-10T17:42:14.999999999Z07:00 4386fb97867d: (from 12de384bfb10) start + 2014-05-10T17:42:14.999999999Z07:00 4386fb97867d: (from 12de384bfb10) die + 2014-05-10T17:42:14.999999999Z07:00 4386fb97867d: (from 12de384bfb10) stop **Show events in the past from a specified time:** $ sudo docker events --since 1378216169 - [2013-09-03 15:49:29 +0200 CEST] 4386fb97867d: (from 12de384bfb10) die - [2013-09-03 15:49:29 +0200 CEST] 4386fb97867d: (from 12de384bfb10) stop + 2014-03-10T17:42:14.999999999Z07:00 4386fb97867d: (from 12de384bfb10) die + 2014-03-10T17:42:14.999999999Z07:00 4386fb97867d: (from 12de384bfb10) stop $ sudo docker events --since '2013-09-03' - [2013-09-03 15:49:26 +0200 CEST] 4386fb97867d: (from 12de384bfb10) start - [2013-09-03 15:49:29 +0200 CEST] 4386fb97867d: (from 12de384bfb10) die - [2013-09-03 15:49:29 +0200 CEST] 4386fb97867d: (from 12de384bfb10) stop + 2014-09-03T17:42:14.999999999Z07:00 4386fb97867d: (from 12de384bfb10) start + 2014-09-03T17:42:14.999999999Z07:00 4386fb97867d: (from 12de384bfb10) die + 2014-09-03T17:42:14.999999999Z07:00 4386fb97867d: (from 12de384bfb10) stop $ sudo docker events --since '2013-09-03 15:49:29 +0200 CEST' - [2013-09-03 15:49:29 +0200 CEST] 4386fb97867d: (from 12de384bfb10) die - [2013-09-03 15:49:29 +0200 CEST] 4386fb97867d: (from 12de384bfb10) stop + 2014-09-03T15:49:29.999999999Z07:00 4386fb97867d: (from 12de384bfb10) die + 2014-09-03T15:49:29.999999999Z07:00 4386fb97867d: (from 12de384bfb10) stop ## export @@ -750,6 +750,10 @@ the container's `STDOUT` and `STDERR`. Passing a negative number or a non-integer to `--tail` is invalid and the value is set to `all` in that case. This behavior may change in the future. +The `docker logs --timestamp` commands will add an RFC3339Nano +timestamp, for example `2014-05-10T17:42:14.999999999Z07:00`, to each +log entry. + ## port Usage: docker port CONTAINER PRIVATE_PORT