• Cloud Container Engine

cce
  1. Help Center
  2. Cloud Container Engine
  3. API Reference
  4. Pod (Native Kubernetes APIs)
  5. Reading Logs of a Specified Pod

Reading Logs of a Specified Pod

Function

This API is used to access the specified Pod object under a specified Namespace and obtain the logs of the Pod object.

URI

GET /api/v1/namespaces/{namespace}/pods/{name}/log

Table 1 describes the parameters of this API.

Table 1 Parameter description

Name

Mandatory

Description

namespace

Yes

Object name and auth scope, such as for teams and projects.

name

Yes

Name of the Pod.

pretty

No

If 'true', then the output is pretty printed.

container

No

The container for which to stream logs. Defaults to only container if there is one container in the pod.

follow

No

Follow the log stream of the pod. Defaults to false.

previous

No

Return previous terminated container logs. Defaults to false.

sinceSeconds

No

A relative time in seconds before the current time from which to show logs. If this value precedes the time a pod was started, only logs since the pod start will be returned. If this value is in the future, no logs will be returned. Only one of sinceSeconds or sinceTime may be specified.

timestamps

No

If true, add an RFC3339 or RFC3339Nano timestamp at the beginning of every line of log output. Defaults to false.

tailLines

No

If set, the number of lines from the end of the logs to show. If not specified, logs are shown from the creation of the container or sinceSeconds or sinceTime.

limitBytes

No

If set, the number of bytes to read from the server before terminating the log output. This may not display a complete final line of logging, and may return slightly more or slightly less than the specified limit.

Request

N/A

Response

Response parameters:

The logs of the Pod are returned.

Example response:

2016/08/04 02:56:39 [asm_amd64.s:1998][I] http server Running on :80
2016/08/04 02:56:39 [asm_amd64.s:1998][I] Admin server Running on :8088

Status Code

Table 2 describes the status code of this API.

Table 2 Status code

Status Code

Description

200

This operation succeeds, and the logs of the Pod are returned.

For the description about status codes, see section Status Codes.