Add --since argument to docker logs cmd

Added --since argument to `docker logs` command. Accept unix
timestamps and shows logs only created after the specified date.

Default value is 0 and passing default value or not specifying
the value in the request causes parameter to be ignored (behavior
prior to this change).

Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
Upstream-commit: cb9a6b9aed1577bb5590300125d05d9b1c201c16
Component: engine
This commit is contained in:
Ahmet Alp Balkan
2015-05-10 20:42:14 +00:00
parent a40ebffc52
commit 365c18080f
15 changed files with 154 additions and 25 deletions
@@ -8,6 +8,7 @@ docker-logs - Fetch the logs of a container
**docker logs**
[**-f**|**--follow**[=*false*]]
[**--help**]
[**--since**[=*SINCE*]]
[**-t**|**--timestamps**[=*false*]]
[**--tail**[=*"all"*]]
CONTAINER
@@ -31,6 +32,9 @@ then continue streaming new output from the container’s stdout and stderr.
**-f**, **--follow**=*true*|*false*
Follow log output. The default is *false*.
**--since**=""
Show logs since timestamp
**-t**, **--timestamps**=*true*|*false*
Show timestamps. The default is *false*.
@@ -42,3 +46,4 @@ April 2014, Originally compiled by William Henry (whenry at redhat dot com)
based on docker.com source material and internal work.
June 2014, updated by Sven Dowideit <SvenDowideit@home.org.au>
July 2014, updated by Sven Dowideit <SvenDowideit@home.org.au>
April 2015, updated by Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
@@ -52,6 +52,12 @@ You can still call an old version of the API using
You can now supply a `stream` bool to get only one set of stats and
disconnect
`GET /containers(id)/logs`
**New!**
This endpoint now accepts a `since` timestamp parameter.
## v1.18
### Full documentation
@@ -477,7 +477,7 @@ Get stdout and stderr logs from the container ``id``
**Example request**:
GET /containers/4fa6e0f0c678/logs?stderr=1&stdout=1&timestamps=1&follow=1&tail=10 HTTP/1.1
GET /containers/4fa6e0f0c678/logs?stderr=1&stdout=1&timestamps=1&follow=1&tail=10&since=1428990821 HTTP/1.1
**Example response**:
@@ -493,6 +493,8 @@ Query Parameters:
- **follow** – 1/True/true or 0/False/false, return stream. Default false
- **stdout** – 1/True/true or 0/False/false, show stdout log. Default false
- **stderr** – 1/True/true or 0/False/false, show stderr log. Default false
- **since** – UNIX timestamp (integer) to filter logs. Specifying a timestamp
will only output log-entries since that timestamp. Default: 0 (unfiltered)
- **timestamps** – 1/True/true or 0/False/false, print timestamps for
every log line. Default false
- **tail** – Output specified number of lines at the end of logs: `all` or `<number>`. Default all
@@ -1616,6 +1616,7 @@ For example:
Fetch the logs of a container
-f, --follow=false Follow log output
--since="" Show logs since timestamp
-t, --timestamps=false Show timestamps
--tail="all" Number of lines to show from the end of the logs
@@ -1635,6 +1636,10 @@ timestamp, for example `2014-09-16T06:17:46.000000000Z`, to each
log entry. To ensure that the timestamps for are aligned the
nano-second part of the timestamp will be padded with zero when necessary.
The `--since` option shows logs of a container generated only after
the given date, specified as RFC 3339 or UNIX timestamp. The `--since` option
can be combined with the `--follow` and `--tail` options.
## pause
Usage: docker pause CONTAINER [CONTAINER...]