Querying Slow Query Logs
Function
This API is used to query the latest 2,000 slow query logs of an instance. Searching by keyword is not supported.
This API will be unavailable. You are advised to switch workloads to the corresponding new API:
Constraints
- This API supports only GeminiDB Cassandra instances with classic storage.
- This API can be used to query only the latest 2000 slow query logs in a specified time range.
Authorization Information
Each account has permissions to call all APIs, but IAM users must have the required permissions specifically assigned.
- If you are using role/policy-based authorization, see the required permissions in Permissions and Supported Actions.
- If you are using identity policy-based authorization, the following identity policy-based permissions are required.
Action
Access Level
Resource Type (*: required)
Condition Key
Alias
Dependencies
gaussdbfornosql:instance:listSlowLog
List
instance *
- g:ResourceTag/<tag-key>
- g:EnterpriseProjectId
nosql:instance:list
-
URI
GET /v3/{project_id}/instances/{instance_id}/slowlog
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Definition Project ID of a tenant in a region. To obtain this value, see Obtaining a Project ID. Constraints N/A Range The value contains 32 characters. Only letters and digits are allowed. Default Value N/A |
| instance_id | Yes | String | Definition Instance ID. To obtain the value, call the Querying Instances and Details API. If no instance is available, call the Creating an Instance API to create one. Constraints N/A Range N/A Default Value N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| start_date | Yes | String | Definition Start time Constraints The start time cannot be 30 days earlier than the current time and cannot be the same as the end time. The value of end_time must be later than that of start_time. The value is in the yyyy-mm-ddThh:mm:ssZ format. T is the separator between the calendar and the hourly notation of time. Z indicates the time zone offset. Range N/A Default Value N/A |
| end_date | Yes | String | Definition End time Constraints The end time cannot be later than the current time and cannot be the same as the start time. The value of end_time must be later than that of start_time. The value is in the yyyy-mm-ddThh:mm:ssZ format. T is the separator between the calendar and the hourly notation of time. Z indicates the time zone offset. Range N/A Default Value N/A |
| offset | No | Integer | Definition Index offset. The query starts from the next piece of data indexed by this parameter. Constraints The value must be a non-negative integer. Range [0,1999] Default Value 0: The query starts from the first data record. |
| limit | No | Integer | Definition Number of records returned by a query. Constraints The sum of values of limit and offset must be 2000 or lower. Range [1,100] Default Value N/A |
| node_id | No | String | Definition Node ID. Constraints N/A Range For details about the value, see field id in Table 11. Default Value If this parameter is not specified, all nodes in the instance can be queried by default. |
| type | No | String | Definition Statement type. Constraints N/A Range SELECT: SELECT logs are queried. Default Value If this parameter is not specified, all statement types are queried by default. |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| X-Auth-Token | Yes | String | Definition User token You can obtain the token by calling the IAM API by following Obtaining a User Token Through Password Authentication. Constraints N/A Range N/A Default Value N/A |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| slow_log_list | Array of SlowlogResult objects | Definition List of slow query log details. |
| total_record | Integer | Definition Total number of records. Range N/A |
| Parameter | Type | Description |
|---|---|---|
| time | String | Definition Statement execution duration. Range N/A |
| database | String | Definition Database which slow query logs belong to. Range N/A |
| query_sample | String | Definition Statement. Range N/A |
| type | String | Definition Statement type Range select |
| start_time | String | Definition UTC time when logs are generated. Range N/A |
Example Requests
- URI example
GET https://{Endpoint}/v3/0483b6b16e954cb88930a360d2c4e663/instances/6ade8143870047b8999aba8f1891b48ein06/slowlog?start_date=2018-08-06T10:41:14+0800&end_date=2018-08-07T10:41:14+0800 - URI example
Querying slow query logs based on specified conditions:
GET https://{Endpoint}/v3/0549b4a43100d4f32f51c01c2fe4acdb/instances/6ade8143870047b8999aba8f1891b48ein06/slowlog?type=SELECT&offset=1&limit=20&node_id=a7c84462483642798cf159237343135fno06&start_date=2018-08-06T10:41:14+0800&end_date=2018-08-07T10:41:14+0800
Example Responses
Status code: 200
Success
{
"total_record" : 1,
"slow_log_list" : [ {
"time" : "513 ms",
"database" : "cassandra",
"query_sample" : "SELECT * FROM cassandra.sz_user LIMIT 100;",
"type" : "SELECT",
"start_time" : "2020-11-15T22:49:38.643000Z"
} ]
} Status Codes
For details, see Status Codes.
Error Codes
For details, see Error Codes.
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot