# Retrieve UDB error logs or slow query logs - DescribeUDBInstanceLog

## Overview

Query the error logs or slow query logs of UDB within a certain period of time






## Definition

### Public Parameters

| Parameter Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **Action**     | string  | Corresponding API command name, the current API is `DescribeUDBInstanceLog`.                      | **Yes** |
| **PublicKey**  | string  | The user's public key can be obtained from [Console](https://console.scloudsg.com/uaccount/api_manage)                                             | **Yes** |
| **Signature**  | string  | User signature generated based on public key and API command, see [Signature Algorithm](/docs/api/summary/signature.md)  | **Yes** |

### Request Parameters

| Parameter Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **Region** | string | Region. See [List of Regions and Availability Zones](/docs/api/summary/regionlist) |**Yes**|
| **Zone** | string | Availability Zone. See [Availability Zone List](/docs/api/summary/regionlist) |No|
| **ProjectId** | string | Project ID. If not filled in, the default project is used, sub-accounts must be filled in. Please refer to the [GetProjectList interface](/docs/api/summary/get_project_list). |No|
| **DBId** | string | Instance ID |**Yes**|
| **BeginTime** | int | The start timestamp (Unix Timestamp) of the queried logs. For real-time queries, this parameter should be the timestamp of the last polling request, and the backend will return the log content from this value to the current time. |**Yes**|
| **EndTime** | int | The end timestamp (Unix Timestamp) for querying logs. This value is not passed for real-time queries, and the difference with BeginTime does not exceed 24 hours: (EndTime-BeginTime) < 24*60*60 |**Yes**|
| **LogType** | string | Types of query logs<br />error: Error log; slow: Slow log |**Yes**|

### Response Field

| Field Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **RetCode** | int | Return status code. If it is 0, it means successful return. If it is not 0, it means failure. |**Yes**|
| **Action** | string | Operation command name. |**Yes**|
| **Message** | string | Returns an error message, providing detailed description when `RetCode` is non-zero. |No|
| **Log** | string | The content of the queried logs, a segment of plain text. |No|
| **NextTime** | string | The next time of the logs queried this time, used for the BeginTime parameter of the next polling; if the log query ends, it will return to null, and the front end ends the query. |No|




## Example

### Request Example
    
```
http://api.scloudsg.com/?Action=DescribeUDBInstanceLog
&DBId=xxxxx
&BeginTime=1497262210
&EndTime=1497323400
&LogType=error
```

### Response Example
    
```json
{
  "Action": "DescribeUDBInstanceLogResponse",
  "Log": "",
  "NextTime": "1497323401",
  "RetCode": 0
}
```





