From ce224853a20017a6580c9285da27a6cbbd059e79 Mon Sep 17 00:00:00 2001 From: Brian Goff Date: Fri, 8 Apr 2016 12:15:08 -0400 Subject: [PATCH] Add support for reading logs extra attrs The jsonlog logger currently allows specifying envs and labels that should be propagated to the log message, however there has been no way to read that back. This adds a new API option to enable inserting these attrs back to the log reader. With timestamps, this looks like so: ``` 92016-04-08T15:28:09.835913720Z foo=bar,hello=world hello ``` The extra attrs are comma separated before the log message but after timestamps. Without timestaps it looks like so: ``` foo=bar,hello=world hello ``` Signed-off-by: Brian Goff --- docs/reference/commandline/logs.md | 5 +++++ man/docker-logs.1.md | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/docs/reference/commandline/logs.md b/docs/reference/commandline/logs.md index 91558ffa63..dd90c4dcc0 100644 --- a/docs/reference/commandline/logs.md +++ b/docs/reference/commandline/logs.md @@ -14,6 +14,7 @@ parent = "smn_cli" Fetch the logs of a container + --details Show extra details provided to logs -f, --follow Follow log output --help Print usage --since="" Show logs since timestamp @@ -36,6 +37,10 @@ The `docker logs --timestamps` command will add an [RFC3339Nano timestamp](https log entry. To ensure that the timestamps are aligned the nano-second part of the timestamp will be padded with zero when necessary. +The `docker logs --details` command will add on extra attributes, such as +environment variables and labels, provided to `--log-opt` when creating the +container. + The `--since` option shows only the container logs generated after a given date. You can specify the date as an RFC 3339 date, a UNIX timestamp, or a Go duration string (e.g. `1m30s`, `3h`). Besides RFC3339 date diff --git a/man/docker-logs.1.md b/man/docker-logs.1.md index f910b53574..db23a0f137 100644 --- a/man/docker-logs.1.md +++ b/man/docker-logs.1.md @@ -30,6 +30,9 @@ logging drivers. **--help** Print usage statement +**--details**=*true*|*false* + Show extra details provided to logs + **-f**, **--follow**=*true*|*false* Follow log output. The default is *false*. @@ -55,6 +58,10 @@ epoch or Unix time), and the optional .nanoseconds field is a fraction of a second no more than nine digits long. You can combine the `--since` option with either or both of the `--follow` or `--tail` options. +The `docker logs --details` command will add on extra attributes, such as +environment variables and labels, provided to `--log-opt` when creating the +container. + # HISTORY April 2014, Originally compiled by William Henry (whenry at redhat dot com) based on docker.com source material and internal work.