Get container logs Run in API Explorer
Get stdout
and stderr
logs from a container.
Note: This endpoint works only for containers with the json-file
or
journald
logging driver.
Query parameters
-
Keep connection after returning logs.
Default value is
false
. -
Return logs from
stdout
Default value is
false
. -
Return logs from
stderr
Default value is
false
. -
Only return logs since this time, as a UNIX timestamp
Default value is
0
. -
Only return logs before this time, as a UNIX timestamp
Default value is
0
. -
Add timestamps to every log line
Default value is
false
. -
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
-
logs returned as a stream in response body. For the stream format, see the documentation for the attach endpoint. Note that unlike the attach endpoint, the logs endpoint does not upgrade the connection and does not set Content-Type.
-
no such container
-
server error
curl \
--request GET 'http://api.example.com/v1.49/containers/{id}/logs'
{
"message": "No such container: c2ada9df5af8"
}
{
"message": "Something went wrong."
}