github.com/pwn-term/docker@v0.0.0-20210616085119-6e977cce2565/cli/docs/reference/commandline/service_logs.md (about)

     1  ---
     2  title: "service logs"
     3  description: "The service logs command description and usage"
     4  keywords: "service, task, logs"
     5  ---
     6  
     7  # service logs
     8  
     9  ```Markdown
    10  Usage:  docker service logs [OPTIONS] SERVICE|TASK
    11  
    12  Fetch the logs of a service or task
    13  
    14  Options:
    15    -f, --follow         Follow log output
    16        --help           Print usage
    17        --no-resolve     Do not map IDs to Names in output
    18        --no-task-ids    Do not include task IDs in output
    19        --no-trunc        Do not truncate output
    20        --since string   Show logs since timestamp
    21    -n, --tail string    Number of lines to show from the end of the logs (default "all")
    22    -t, --timestamps     Show timestamps
    23  ```
    24  
    25  ## Description
    26  
    27  The `docker service logs` command batch-retrieves logs present at the time of execution.
    28  
    29  > **Note**
    30  >
    31  > This is a cluster management command, and must be executed on a swarm
    32  > manager node. To learn about managers and workers, refer to the
    33  > [Swarm mode section](https://docs.docker.com/engine/swarm/) in the
    34  > documentation.
    35  
    36  The `docker service logs` command can be used with either the name or ID of a
    37  service, or with the ID of a task. If a service is passed, it will display logs
    38  for all of the containers in that service. If a task is passed, it will only
    39  display logs from that particular task.
    40  
    41  > **Note**
    42  >
    43  > This command is only functional for services that are started with
    44  > the `json-file` or `journald` logging driver.
    45  
    46  For more information about selecting and configuring logging drivers, refer to
    47  [Configure logging drivers](https://docs.docker.com/config/containers/logging/configure/).
    48  
    49  The `docker service logs --follow` command will continue streaming the new output from
    50  the service's `STDOUT` and `STDERR`.
    51  
    52  Passing a negative number or a non-integer to `--tail` is invalid and the
    53  value is set to `all` in that case.
    54  
    55  The `docker service logs --timestamps` command will add an [RFC3339Nano timestamp](https://golang.org/pkg/time/#pkg-constants)
    56  , for example `2014-09-16T06:17:46.000000000Z`, to each
    57  log entry. To ensure that the timestamps are aligned the
    58  nano-second part of the timestamp will be padded with zero when necessary.
    59  
    60  The `docker service logs --details` command will add on extra attributes, such as
    61  environment variables and labels, provided to `--log-opt` when creating the
    62  service.
    63  
    64  The `--since` option shows only the service logs generated after
    65  a given date. You can specify the date as an RFC 3339 date, a UNIX
    66  timestamp, or a Go duration string (e.g. `1m30s`, `3h`). Besides RFC3339 date
    67  format you may also use RFC3339Nano, `2006-01-02T15:04:05`,
    68  `2006-01-02T15:04:05.999999999`, `2006-01-02Z07:00`, and `2006-01-02`. The local
    69  timezone on the client will be used if you do not provide either a `Z` or a
    70  `+-00:00` timezone offset at the end of the timestamp. When providing Unix
    71  timestamps enter seconds[.nanoseconds], where seconds is the number of seconds
    72  that have elapsed since January 1, 1970 (midnight UTC/GMT), not counting leap
    73  seconds (aka Unix epoch or Unix time), and the optional .nanoseconds field is a
    74  fraction of a second no more than nine digits long. You can combine the
    75  `--since` option with either or both of the `--follow` or `--tail` options.
    76  
    77  ## Related commands
    78  
    79  * [service create](service_create.md)
    80  * [service inspect](service_inspect.md)
    81  * [service ls](service_ls.md)
    82  * [service ps](service_ps.md)
    83  * [service rm](service_rm.md)
    84  * [service rollback](service_rollback.md)
    85  * [service scale](service_scale.md)
    86  * [service update](service_update.md)