# 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.

<table><thead><tr><th width="192.3012048192771">Parameter Name</th><th width="114">Required</th><th width="125">Type</th><th>Description</th></tr></thead><tbody><tr><td>startTime</td><td>Yes</td><td>Timestamp</td><td><p>Start time.</p><p>Use UTC time according to the ISO8601 standard. Format: <code>yyyy-MM-ddTHH:mm:ssZ</code>.</p></td></tr><tr><td>endTime</td><td>Yes</td><td>Timestamp</td><td><p>End time.</p><p>Use UTC time according to the ISO8601 standard. Format: <code>yyyy-MM-ddTHH:mm:ssZ</code>.</p><ul><li>Start time must be earlier than end time.</li><li>The interval between start time and end time should be less than 30 days.</li><li>Start time cannot be more than 90 days ago.</li></ul></td></tr><tr><td>resUid</td><td>No</td><td>String</td><td>Resource ID.</td></tr><tr><td>resEvent</td><td>No</td><td>String</td><td>Event name.</td></tr><tr><td>clientIP</td><td>No</td><td>String</td><td>IP of the user executed the operation.</td></tr><tr><td>size</td><td>No</td><td>Integer</td><td><p>Number of pages returned.</p><p>Default value: 20;</p><p>Maximum value: 1000.</p></td></tr><tr><td>cursor</td><td>No</td><td>Array of Object</td><td>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.<br>For example: <code>cursor</code>: <code>[1691028715371]</code> is returned in current response. When the data of next page is requested, assign <code>[1691028715371]</code> to <code>cursor</code>.</td></tr></tbody></table>

## 3. Output Parameters

<table><thead><tr><th width="199.33333333333331">Parameter Name</th><th width="156">Type</th><th>Description</th></tr></thead><tbody><tr><td>requestId</td><td>String</td><td>The unique request ID, which is returned for each request. RequestId is required for locating a problem.</td></tr><tr><td>cursor</td><td>Array of Object</td><td>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.<br>For example: <code>cursor</code>: <code>[1691028715371]</code> is returned in current response. When the data of next page is requested, assign <code>[1691028715371]</code> to <code>cursor</code>.</td></tr><tr><td>dataSet</td><td>Array of <a href="../../datastructure#loginfo">LogInfo​</a></td><td>Information on logs.</td></tr></tbody></table>

## 4. Code Example

{% tabs %}
{% tab title="Example" %}
**Queries list of logs.**

<pre class="language-json"><code class="lang-json">POST /api/v2/zls HTTP/1.1
Host: console.zenlayer.com
Content-Type: application/json
X-ZC-Action: DescribeLogs
&#x3C;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": [
<strong>        {
</strong>            "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]
  }
}
</code></pre>

{% endtab %}
{% endtabs %}

## 5. Developer Resources <a href="#id-5.-kai-fa-zhe-gong-ju" id="id-5.-kai-fa-zhe-gong-ju"></a>

Zenlayer Cloud API 2.0 integrates [SDKs](https://docs.console.zenlayer.com/api-reference/api-introduction/toolkit/api-sdk) 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](https://docs.console.zenlayer.com/api-reference/api-introduction/instruction/commonerrorcode).​​

<table><thead><tr><th width="204.33333333333331">HTTP Status Code</th><th width="140">Error Code</th><th>Description</th></tr></thead><tbody><tr><td><strong>400</strong></td><td>INVALID_TIME_FORMAT</td><td>Invalid time format.<br>Format: <code>yyyy-MM-ddTHH:mm:ssZ</code>.</td></tr><tr><td><strong>400</strong></td><td>INVALID_PARAMETER__ILLEGAL_TIME</td><td><p>Invalid time.</p><ul><li>Start time must be earlier than end time.</li><li>The interval between start time and end time should be less than 30 days.</li><li>Start time cannot be more than 90 days ago.</li></ul></td></tr></tbody></table>
