github.com/sijibomii/docker@v0.0.0-20231230191044-5cf6ca554647/docs/reference/commandline/logs.md (about)

     1  <!--[metadata]>
     2  +++
     3  title = "logs"
     4  description = "The logs command description and usage"
     5  keywords = ["logs, retrieve, docker"]
     6  [menu.main]
     7  parent = "smn_cli"
     8  +++
     9  <![end-metadata]-->
    10  
    11  # logs
    12  
    13      Usage: docker logs [OPTIONS] CONTAINER
    14  
    15      Fetch the logs of a container
    16  
    17        -f, --follow              Follow log output
    18        --help                    Print usage
    19        --since=""                Show logs since timestamp
    20        -t, --timestamps          Show timestamps
    21        --tail="all"              Number of lines to show from the end of the logs
    22  
    23  > **Note**: this command is available only for containers with `json-file` and
    24  > `journald` logging drivers.
    25  
    26  The `docker logs` command batch-retrieves logs present at the time of execution.
    27  
    28  The `docker logs --follow` command will continue streaming the new output from
    29  the container's `STDOUT` and `STDERR`.
    30  
    31  Passing a negative number or a non-integer to `--tail` is invalid and the
    32  value is set to `all` in that case.
    33  
    34  The `docker logs --timestamps` command will add an [RFC3339Nano timestamp](https://golang.org/pkg/time/#pkg-constants)
    35  , for example `2014-09-16T06:17:46.000000000Z`, to each
    36  log entry. To ensure that the timestamps are aligned the
    37  nano-second part of the timestamp will be padded with zero when necessary.
    38  
    39  The `--since` option shows only the container logs generated after
    40  a given date. You can specify the date as an RFC 3339 date, a UNIX
    41  timestamp, or a Go duration string (e.g. `1m30s`, `3h`). Besides RFC3339 date
    42  format you may also use RFC3339Nano, `2006-01-02T15:04:05`,
    43  `2006-01-02T15:04:05.999999999`, `2006-01-02Z07:00`, and `2006-01-02`. The local
    44  timezone on the client will be used if you do not provide either a `Z` or a
    45  `+-00:00` timezone offset at the end of the timestamp. When providing Unix
    46  timestamps enter seconds[.nanoseconds], where seconds is the number of seconds
    47  that have elapsed since January 1, 1970 (midnight UTC/GMT), not counting leap
    48  seconds (aka Unix epoch or Unix time), and the optional .nanoseconds field is a
    49  fraction of a second no more than nine digits long. You can combine the
    50  `--since` option with either or both of the `--follow` or `--tail` options.