Updated on 2024-04-16 GMT+08:00

Obtaining ECS Management Console Logs

Function

This API is used to obtain ECS management console logs.

URI

POST /v2.1/{project_id}/servers/{server_id}/action

Table 1 describes the parameters in the URI.
Table 1 Parameter description

Parameter

Mandatory

Description

project_id

Yes

Specifies the project ID.

For details about how to obtain the ID, see Obtaining a Project ID.

server_id

Yes

Specifies the ECS ID.

Constraints

This API will be discarded since a version later than microversion 2.5. When using this API, set the microversion to 2.5 or earlier.

Request

Table 2 describes the request parameters.

Table 2 Request parameters

Parameter

Mandatory

Type

Description

os-getConsoleOutput

Yes

Object

Obtains ECS management console logs. For details, see Table 3.

Table 3 os-getConsoleOutput parameter description

Parameter

Mandatory

Type

Description

length

Yes

Integer

Specifies the number of request log rows. The value is greater than or equal to -1, which indicates that the output is not limited.

Response

Table 4 describes the response parameter.

Table 4 Response parameter

Parameter

Type

Description

output

String

ECS console log results

Example Request

Obtain console logs of a specified ECS.

POST https://{endpoint}/v2.1/9c53a566cb3443ab910cf0daebca90c4/servers/47e9be4e-a7b9-471f-92d9-ffc83814e07a/action

{
   "os-getConsoleOutput" : {
        "length" : "50"
    }
}

Example Response

{
    "output": "FAKE CONSOLEOUTPUT\nANOTHER\nLAST LINE"
}