Queries the logs of an instance.

You may not obtain the instance logs that were generated more than seven days ago.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes GetInstanceLog

The operation that you want to perform. Set the value to GetInstanceLog.

InstanceId Long Yes 1234

The ID of the instance.

RegionId String Yes cn-shanghai

The region ID. For example, the ID of the China (Shanghai) region is cn-shanghai, and that of the China (Zhangjiakou) region is cn-zhangjiakou. The system determines the value of this parameter based on the endpoint that is used to call the operation.

ProjectEnv String Yes PROD

The environment of the workspace. Valid values: PROD and DEV.

InstanceHistoryId Long No 1

The historical record number of the instance. You can call the ListInstanceHistory operation to query the ID.

Response parameters

Parameter Type Example Description
HttpStatusCode Integer 200

The HTTP status code returned.

Data String log_content

The content of the logs.

ErrorMessage String The connection does not exist.

The error message returned.

RequestId String E6F0DBDD-5AD****

The ID of the request. You can locate logs and troubleshoot issues based on the ID.

ErrorCode String Invalid.Tenant.ConnectionNotExists

The error code returned.

Success Boolean true

Indicates whether the request is successful.

Examples

Sample requests

http(s)://[Endpoint]/?Action=GetInstanceLog
&InstanceId=1234
&ProjectEnv=PROD
&InstanceHistoryId=1
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<GetInstanceLogResponse>
    <HttpStatusCode>200</HttpStatusCode>
    <Data>log_content</Data>
    <ErrorMessage>The connection does not exist.</ErrorMessage>
    <RequestId>E6F0DBDD-5AD****</RequestId>
    <ErrorCode>Invalid.Tenant.ConnectionNotExists</ErrorCode>
    <Success>true</Success>
</GetInstanceLogResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "HttpStatusCode" : 200,
  "Data" : "log_content",
  "ErrorMessage" : "The connection does not exist.",
  "RequestId" : "E6F0DBDD-5AD****",
  "ErrorCode" : "Invalid.Tenant.ConnectionNotExists",
  "Success" : true
}

Error codes

For a list of error codes, visit the API Error Center.