DescribeLogs

1. API Description

This API is used to query the list of logs.

2. Input Parameters

The following request parameter list only provides API request parameters.

Parameter NameRequiredTypeDescription

startTime

Yes

Timestamp

Start time.

Use UTC time according to the ISO8601 standard. Format: yyyy-MM-ddTHH:mm:ssZ.

endTime

Yes

Timestamp

End time.

Use UTC time according to the ISO8601 standard. Format: yyyy-MM-ddTHH:mm:ssZ.

  • Start time must be earlier than end time.

  • The interval between start time and end time should be less than 30 days.

  • Start time cannot be more than 90 days ago.

resUid

No

String

Resource ID.

resEvent

No

String

Event name.

clientIP

No

String

IP of the user executed the operation.

size

No

Integer

Number of pages returned.

Default value: 20;

Maximum value: 1000.

cursor

No

Array of Object

Cursor for the next page. When the data of this page is requested, the cursor for the next page will be returned in the response result. When the data of the next page needs to be obtained, that cursor needs to be added into the input parameter, and all data in the time period can be obtained by looping in turn. For example: cursor: [1691028715371] is returned in current response. When the data of next page is requested, assign [1691028715371] to cursor.

3. Output Parameters

Parameter NameTypeDescription

requestId

String

The unique request ID, which is returned for each request. RequestId is required for locating a problem.

cursor

Array of Object

Cursor for the next page. When the data of this page is requested, the cursor for the next page will be returned in the response result. When the data of the next page needs to be obtained, that cursor needs to be added into the input parameter, and all data in the time period can be obtained by looping in turn. For example: cursor: [1691028715371] is returned in current response. When the data of next page is requested, assign [1691028715371] to cursor.

dataSet

Array of LogInfo​

Information on logs.

4. Code Example

Queries list of logs.

POST /api/v2/zls HTTP/1.1
Host: console.zenlayer.com
Content-Type: application/json
X-ZC-Action: DescribeLogs
<Common Request Params>

Request:
{
    "startTime":"2023-07-26T16:00:00Z",
    "endTime":"2023-08-03T15:59:59Z",
    "size":20
}

Response:
{
  "requestId": "T83B6A963-B111-4BF9-8466-1C3351E2DFD1",
  "response": {
    "requestId": "T83B6A963-B111-4BF9-8466-1C3351E2DFD1",
    "dataSet": [
        {
            "resUid": "user/*|team/123",
            "resType": "user",
            "resEvent": "switch  team",
            "opsTime": "2023-08-03T07:56:28.670Z",
            "eventSource": "CONSOLE_CALL",
            "apiVersion": "v1",
            "opsUser": "test@zenlayer.com",
            "clientIP": "10.88.61.84",
            "request": null,
            "response": "{\"msg\":\"success\",\"ret\":0,\"code\":\"SUCCESS\",\"success\":true}"
        },
        {
            "resUid": "bmi/123",
            "resType": "bmi",
            "resEvent": "rename bmi",
            "opsTime": "2023-08-03T06:52:23.008Z",
            "eventSource": "CONSOLE_CALL",
            "apiVersion": "v1",
            "opsUser": "test@zenlayer.com",
            "clientIP": "10.88.61.100",
            "request": "{\"label\":\"xxx\"}",
            "response": "{\"msg\":\"success\",\"ret\":0,\"code\":\"SUCCESS\",\"success\":true}"
        },
    ],
    "cursor": [1691028715371]
  }
}

5. Developer Resources

Zenlayer Cloud API 2.0 integrates SDKs to make it easier for you to call APIs. More programming languages will be supported.

6. Error Codes

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.​​

HTTP Status CodeError CodeDescription

400

INVALID_TIME_FORMAT

Invalid time format. Format: yyyy-MM-ddTHH:mm:ssZ.

400

INVALID_PARAMETER__ILLEGAL_TIME

Invalid time.

  • Start time must be earlier than end time.

  • The interval between start time and end time should be less than 30 days.

  • Start time cannot be more than 90 days ago.

Last updated