github.com/olljanat/moby@v1.13.1/docs/reference/commandline/logs.md (about)

     1  ---
     2  title: "logs"
     3  description: "The logs command description and usage"
     4  keywords: "logs, retrieve, docker"
     5  ---
     6  
     7  <!-- This file is maintained within the docker/docker Github
     8       repository at https://github.com/docker/docker/. Make all
     9       pull requests against that repo. If you see this file in
    10       another repository, consider it read-only there, as it will
    11       periodically be overwritten by the definitive file. Pull
    12       requests which include edits to this file in other repositories
    13       will be rejected.
    14  -->
    15  
    16  # logs
    17  
    18  ```markdown
    19  Usage:  docker logs [OPTIONS] CONTAINER
    20  
    21  Fetch the logs of a container
    22  
    23  Options:
    24        --details        Show extra details provided to logs
    25    -f, --follow         Follow log output
    26        --help           Print usage
    27        --since string   Show logs since timestamp
    28        --tail string    Number of lines to show from the end of the logs (default "all")
    29    -t, --timestamps     Show timestamps
    30  ```
    31  
    32  The `docker logs` command batch-retrieves logs present at the time of execution.
    33  
    34  > **Note**: this command is only functional for containers that are started with
    35  > the `json-file` or `journald` logging driver.
    36  
    37  For more information about selecting and configuring logging drivers, refer to
    38  [Configure logging drivers](https://docs.docker.com/engine/admin/logging/overview/).
    39  
    40  The `docker logs --follow` command will continue streaming the new output from
    41  the container's `STDOUT` and `STDERR`.
    42  
    43  Passing a negative number or a non-integer to `--tail` is invalid and the
    44  value is set to `all` in that case.
    45  
    46  The `docker logs --timestamps` command will add an [RFC3339Nano timestamp](https://golang.org/pkg/time/#pkg-constants)
    47  , for example `2014-09-16T06:17:46.000000000Z`, to each
    48  log entry. To ensure that the timestamps are aligned the
    49  nano-second part of the timestamp will be padded with zero when necessary.
    50  
    51  The `docker logs --details` command will add on extra attributes, such as
    52  environment variables and labels, provided to `--log-opt` when creating the
    53  container.
    54  
    55  The `--since` option shows only the container logs generated after
    56  a given date. You can specify the date as an RFC 3339 date, a UNIX
    57  timestamp, or a Go duration string (e.g. `1m30s`, `3h`). Besides RFC3339 date
    58  format you may also use RFC3339Nano, `2006-01-02T15:04:05`,
    59  `2006-01-02T15:04:05.999999999`, `2006-01-02Z07:00`, and `2006-01-02`. The local
    60  timezone on the client will be used if you do not provide either a `Z` or a
    61  `+-00:00` timezone offset at the end of the timestamp. When providing Unix
    62  timestamps enter seconds[.nanoseconds], where seconds is the number of seconds
    63  that have elapsed since January 1, 1970 (midnight UTC/GMT), not counting leap
    64  seconds (aka Unix epoch or Unix time), and the optional .nanoseconds field is a
    65  fraction of a second no more than nine digits long. You can combine the
    66  `--since` option with either or both of the `--follow` or `--tail` options.