From ef340fecb13d0b00a535971fb63391939e733ac6 Mon Sep 17 00:00:00 2001 From: miaohb Date: Sun, 8 Oct 2017 23:54:08 -0700 Subject: [PATCH] Add api-ref for container logs This patch adds api-ref for container logs. Closes-Bug: #1720924 Change-Id: I652a5a592ecfe0f06e8df594ba4074f285ab891c --- api-ref/source/containers.inc | 48 ++++++++++++++++++- api-ref/source/parameters.yaml | 30 ++++++++++++ .../source/samples/container-logs-req.json | 7 +++ 3 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 api-ref/source/samples/container-logs-req.json diff --git a/api-ref/source/containers.inc b/api-ref/source/containers.inc index 6e3283dbc..78000bd83 100644 --- a/api-ref/source/containers.inc +++ b/api-ref/source/containers.inc @@ -6,7 +6,7 @@ Lists, creates, shows details for, stats, updates, deletes, starts, resize, stops, pauses, unpauses, restarts, renames, commits containers, and adds -security group for specified container. +security group for specified container, gets logs of a container. Create new container ==================== @@ -819,3 +819,49 @@ This request does not return anything in the response body. .. rest_parameters:: parameters.yaml - X-Openstack-Request-Id: request_id + + +Get logs of a container +======================= + +.. rest_method:: GET /v1/containers/{container_ident}/logs?timestamps={timestamps}&&since={since}&tail={tail}&stderr={stderr}&stdout={stdout} + +Get logs of a container. + +Response Codes +-------------- + +.. rest_status_code:: success status.yaml + + - 200 + +.. rest_status_code:: error status.yaml + + - 400 + - 401 + - 403 + - 404 + +Request +------- + +.. rest_parameters:: parameters.yaml + + - container_ident: container_ident + - timestamps: timestamps + - tail: tail + - stderr: stderr + - stdout: stdout + - since: since + +Request Example +---------------- + +.. literalinclude:: samples/container-logs-req.json + :language: javascript + +Response +-------- + +This request returns logs string as a response, which is +not in json format. diff --git a/api-ref/source/parameters.yaml b/api-ref/source/parameters.yaml index 65d79479b..b54b4cd45 100644 --- a/api-ref/source/parameters.yaml +++ b/api-ref/source/parameters.yaml @@ -53,18 +53,48 @@ security_group_query: in: query required: true type: string +since: + description: | + Show logs since a given datetime or integer epoch (in seconds). + in: query + required: false + type: string +stderr: + description: | + Get standard error if True. + in: query + required: false + type: boolean +stdout: + description: | + Get standard output if True. + in: query + required: false + type: boolean tag: description: | The tag of the container image. in: query required: true type: string +tail: + description: | + Number of lines to show from the end of the logs, default is get all logs. + in: query + required: false + type: string timeout: description: | Seconds to wait before operating on container. in: query required: true type: string +timestamps: + description: | + Whether to show timestamps in the logs of container. + in: query + required: false + type: boolean width: description: | The tty width of a container. diff --git a/api-ref/source/samples/container-logs-req.json b/api-ref/source/samples/container-logs-req.json new file mode 100644 index 000000000..de2c833e1 --- /dev/null +++ b/api-ref/source/samples/container-logs-req.json @@ -0,0 +1,7 @@ +{ + "timestamps": "True", + "tail": "all", + "since": "600000", + "stderr": "True", + "stdout": "True" +}