Merge pull request #6803 from vieux/pr_6176

Implement tail for docker logs
Upstream-commit: 49d49ac98f06d0016bcbda56f3ef158c64167bae
Component: engine
This commit is contained in:
Victor Vieux
2014-07-01 14:59:37 -07:00
8 changed files with 317 additions and 32 deletions

View File

@ -306,7 +306,7 @@ Get stdout and stderr logs from the container ``id``
**Example request**:
GET /containers/4fa6e0f0c678/logs?stderr=1&stdout=1&timestamps=1&follow=1 HTTP/1.1
GET /containers/4fa6e0f0c678/logs?stderr=1&stdout=1&timestamps=1&follow=1&tail=10 HTTP/1.1
**Example response**:
@ -319,14 +319,12 @@ Get stdout and stderr logs from the container ``id``
 
- **follow** 1/True/true or 0/False/false, return stream.
Default false
- **stdout** 1/True/true or 0/False/false, if logs=true, return
stdout log. Default false
- **stderr** 1/True/true or 0/False/false, if logs=true, return
stderr log. Default false
- **timestamps** 1/True/true or 0/False/false, if logs=true, print
timestamps for every log line. Default false
- **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
- **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
Status Codes:

View File

@ -738,13 +738,15 @@ specify this by adding the server name.
-f, --follow=false Follow log output
-t, --timestamps=false Show timestamps
--tail="all" Output the specified number of lines at the end of logs (defaults to all logs)
The `docker logs` command batch-retrieves all logs
present at the time of execution.
The `docker logs` command batch-retrieves logs present at the time of execution.
The ``docker logs --follow`` command will first return all logs from the
beginning and then continue streaming new output from the container's `STDOUT`
and `STDERR`.
The `docker logs --follow` command will continue streaming the new output from
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.
## port