Querying Slow Query Logs of a GeminiDB Cassandra Instance
Function
This API is used to query slow query logs of GeminiDB Cassandra instances. Searching for slow query logs by keyword is supported.
Constraints
- Operators &&, ||, AND, OR, NOT, *, ?, :, >, <, =, >=, and <= cannot be used to search for logs.
- The query must be within the period specified by start_time and end_time.
- The value of line_num must be obtained from the log information returned for the last query. This parameter is optional for the first query.
- A maximum of 100 records can be queried on each page, and slow query logs can be stored for a maximum of 30 days.
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
POST /v3/{project_id}/cassandra/instances/{instance_id}/slow-logs
| 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 |
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 |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| start_time | 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_time | 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 |
| limit | Yes | Integer | Definition Number of logs queried each time Constraints N/A Range 1–100 Default Value N/A |
| line_num | No | String | Definition Sequence number of a single log line. The current query starts from the next log of line_num, excluding the log of line_num. Constraints This parameter is not required for the first query. The value can be obtained from the response of the last query. Range N/A Default Value N/A |
| operate_type | No | String | Definition Statement type Constraints N/A Range select: Only SELECT statements are queried. Default Value If this parameter is not specified, all statement types are queried. |
| node_id | No | String | Definition Node ID, which is used to query slow logs of a specific node. For details about the value, see field id in Table 11. Constraints N/A Range N/A Default Value If this parameter is not specified, all nodes in the instance can be queried. |
| keywords | No | Array of strings | Definition Full-text log search based on multiple keywords, indicating that all keywords are matched. Constraints A maximum of 10 keywords are supported. Each keyword can contain a maximum of 512 characters. |
| keyspace_keywords | No | Array of strings | Definition Fuzzy search for logs based on multiple keyspace keywords, indicating that at least one keyword is matched. Constraints
|
| table_keywords | No | Array of strings | Definition Fuzzy search for logs based on multiple database table name keywords, indicating that at least one keyword is matched. Constraints
|
| max_cost_time | No | Integer | Definition Logs can be searched based on the maximum execution duration. Unit: ms Constraints N/A Range N/A Default Value N/A |
| min_cost_time | No | Integer | Definition Logs can be searched based on the minimum execution duration. Unit: ms Constraints N/A Range N/A Default Value N/A |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| slow_logs | Array of Table 5 objects | Definition Slow log information. |
| Parameter | Type | Description |
|---|---|---|
| node_name | String | Definition Node name. Range N/A |
| node_id | String | Definition Node ID. Range N/A |
| whole_message | String | Definition Statement. Range N/A |
| operate_type | String | Definition Statement type. Range select: The statement type recorded in the log is SELECT. |
| cost_time | Integer | Definition Execution time. Unit: ms Range N/A |
| keyspace | String | Definition Database keyspace. Range N/A |
| table | String | Definition Table name. Range N/A |
| log_time | String | Definition UTC time when a log is generated. The value is in the yyyy-mm-ddThh:mm:ssZ format, where T is the separator between the calendar and the hourly notation of time, and Z indicates the time zone offset. Range N/A |
| line_num | String | Definition Sequence number of a log line. Range N/A |
Example Requests
POST https://{Endpoint}/v3/619d3e78f61b4be68bc5aa0b59edcf7b/cassandra/instances/853f97101a9a4f618202f281cda82e92in06/slow-logs
{
"start_time" : "2023-01-06T10:41:14+0800",
"end_time" : "2023-01-10T10:41:14+0800",
"limit" : 100,
"line_num" : "1595659490239433658",
"operate_type" : "select",
"node_id" : "8b76c35e91eb4c9d82fe25417d750cb5no06",
"keywords" : [ "log", "test" ],
"keyspace_keywords" : [ "system", "system_auth" ],
"table_keywords" : [ "test" ],
"max_cost_time" : 100,
"min_cost_time" : 50
} Example Responses
Status code: 200
Success
{
"slow_logs" : [ {
"node_name" : "test_priam_node_1",
"node_id" : "8b76c35e91eb4c9d82fe25417d750cb5no06",
"keyspace" : "system",
"table" : "test",
"whole_message" : "GqKc6_S",
"operate_type" : "select",
"cost_time" : 60,
"log_time" : "2023-01-09T05:42:32+0000",
"line_num" : "1595659490239433659"
} ]
} 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