Get task logs Run in API Explorer

GET /tasks/{id}/logs

Get stdout and stderr logs from a task. See also /containers/{id}/logs.

Note: This endpoint works only for services with the local, json-file or journald logging drivers.

Path parameters

  • id string Required

    ID of the task

Query parameters

  • details boolean

    Show task context and extra details provided to logs.

    Default value is false.

  • follow boolean

    Keep connection after returning logs.

    Default value is false.

  • stdout boolean

    Return logs from stdout

    Default value is false.

  • stderr boolean

    Return logs from stderr

    Default value is false.

  • since integer

    Only return logs since this time, as a UNIX timestamp

    Default value is 0.

  • timestamps boolean

    Add timestamps to every log line

    Default value is false.

  • tail string

    Only return this number of log lines from the end of the logs. Specify as an integer or all to output all log lines.

    Default value is all.

Responses

GET /tasks/{id}/logs
curl \
 --request GET 'http://api.example.com/v1.44/tasks/{id}/logs'
Response examples (404)
{
  "message": "No such task: c2ada9df5af8"
}
Response examples (500)
{
  "message": "Something went wrong."
}
Response examples (503)
{
  "message": "Something went wrong."
}