@@ -9,14 +9,14 @@ Fetch the logs of a container
99
1010### Options
1111
12- | Name | Type | Default | Description |
13- | :---------------------| :---------| :--------| :---------------------------------------------------------------------------------------------------|
14- | ` --details ` | ` bool ` | | Show extra details provided to logs |
15- | ` -f ` , ` --follow ` | ` bool ` | | Follow log output |
16- | ` --since ` | ` string ` | | Show logs since timestamp (e.g. ` 2013-01-02T13:23:37Z ` ) or relative (e.g. ` 42m ` for 42 minutes) |
17- | ` -n ` , ` --tail ` | ` string ` | ` all ` | Number of lines to show from the end of the logs |
18- | ` -t ` , ` --timestamps ` | ` bool ` | | Show timestamps |
19- | [ ` --until ` ] ( #until ) | ` string ` | | Show logs before a timestamp (e.g. ` 2013-01-02T13:23:37Z ` ) or relative (e.g. ` 42m ` for 42 minutes) |
12+ | Name | Type | Default | Description |
13+ | :--------------------------------------------------- | :---------| :--------| :---------------------------------------------------------------------------------------------------|
14+ | [ ` --details ` ] ( #details ) | ` bool ` | | Show extra details provided to logs |
15+ | [ ` -f ` ] ( #follow ) , [ ` --follow ` ] ( #follow ) | ` bool ` | | Follow log output |
16+ | [ ` --since ` ] ( #since ) | ` string ` | | Show logs since timestamp (e.g. ` 2013-01-02T13:23:37Z ` ) or relative (e.g. ` 42m ` for 42 minutes) |
17+ | [ ` -n ` ] ( #tail ) , [ ` --tail ` ] ( #tail ) | ` string ` | ` all ` | Number of lines to show from the end of the logs |
18+ | [ ` -t ` ] ( #timestamps ) , [ ` --timestamps ` ] ( #timestamps ) | ` bool ` | | Show timestamps |
19+ | [ ` --until ` ] ( #until ) | ` string ` | | Show logs before a timestamp (e.g. ` 2013-01-02T13:23:37Z ` ) or relative (e.g. ` 42m ` for 42 minutes) |
2020
2121
2222<!-- -MARKER_GEN_END-->
@@ -28,21 +28,34 @@ The `docker logs` command batch-retrieves logs present at the time of execution.
2828For more information about selecting and configuring logging drivers, refer to
2929[ Configure logging drivers] ( https://docs.docker.com/engine/logging/configure/ ) .
3030
31+ ## Examples
32+
33+ ### <a name =" follow " ></a > Stream log output (-f, --follow)
34+
3135The ` docker logs --follow ` command will continue streaming the new output from
3236the container's ` STDOUT ` and ` STDERR ` .
3337
38+ ### <a name =" tail " ></a > Retrieve the last logs (-n, --tail)
39+
3440Passing a negative number or a non-integer to ` --tail ` is invalid and the
3541value is set to ` all ` in that case.
3642
43+
44+ ### <a name =" timestamps " ></a > Retrieve logs with timestamps (-t, --timestamps)
45+
3746The ` docker logs --timestamps ` command will add an [ RFC3339Nano timestamp] ( https://pkg.go.dev/time#RFC3339Nano )
3847, for example ` 2014-09-16T06:17:46.000000000Z ` , to each
3948log entry. To ensure that the timestamps are aligned the
4049nano-second part of the timestamp will be padded with zero when necessary.
4150
51+ ### <a name =" details " ></a > Retrieve logs with additional attributes (--details)
52+
4253The ` docker logs --details ` command will add on extra attributes, such as
4354environment variables and labels, provided to ` --log-opt ` when creating the
4455container.
4556
57+ ### <a name =" since " ></a > Retrieve logs generated since a specific point in time (--since)
58+
4659The ` --since ` option shows only the container logs generated after
4760a given date. You can specify the date as an RFC 3339 date, a UNIX
4861timestamp, or a Go duration string (e.g. ` 1m30s ` , ` 3h ` ). Besides RFC3339 date
@@ -56,7 +69,6 @@ seconds (aka Unix epoch or Unix time), and the optional .nanoseconds field is a
5669fraction of a second no more than nine digits long. You can combine the
5770` --since ` option with either or both of the ` --follow ` or ` --tail ` options.
5871
59- ## Examples
6072
6173### <a name =" until " ></a > Retrieve logs until a specific point in time (--until)
6274
0 commit comments