Exporting the Quantity Trend of Slow Query Logs
Function
After Slow Query Logs is enabled, you can export the quantity trend of slow query logs. For free instances, you can only view data generated in the latest hour. The maximum query interval is one day.
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 Policies 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
das:clouddba:slowSqlExport
List
Instance
-
-
-
URI
GET /v3/{project_id}/instances/{instance_id}/slow-sql-trend
|
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 can contain 32 characters, including only letters and digits. Default Value N/A |
|
instance_id |
Yes |
String |
Definition Unique ID of an instance Constraints N/A Range The value can contain 32 characters, including only letters and digits. Default Value N/A |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
start_at |
Yes |
Long |
Definition Start time Constraints Unix timestamp, in milliseconds Range [0, 2^31-1]. The actual value depends on the query result. Default Value N/A |
|
end_at |
Yes |
Long |
Definition End time Constraints Unix timestamp, in milliseconds Range [0, 2^31-1]. The actual value depends on the query result. Default Value N/A |
|
datastore_type |
Yes |
String |
Definition Database type Constraints N/A Range
Default Value N/A |
|
node_id |
No |
String |
Definition Node ID Constraints N/A Range The value can contain 32 characters, including only letters and digits. Default Value N/A |
|
offset |
No |
Integer |
Definition Index offset. The query starts from the next piece of data indexed by this parameter. If this parameter is set to 1 and limit is set to 10, only the second to eleventh records are displayed. Constraints N/A Range [0, 2^31-1] Default Value 0: The query starts from the first data record. |
|
limit |
No |
Integer |
Definition Number of records to be queried. If this parameter is set to 10, a maximum of 10 records can be displayed. Constraints N/A Range [1, 100] Default Value 20 |
Request Parameters
None
Response Parameters
Status code: 200
|
Parameter |
Type |
Description |
|---|---|---|
|
slow_sql_trend_items |
Array of Table 4 objects |
Definition Quantity trend of slow query logs Range N/A |
|
interval_millis |
Long |
Definition Query interval Range The interval is 10s if the query duration is within one hour, 60s if the query duration is within six hours, and 300s if the query duration is longer than six hours. The unit is millisecond. |
|
total_count |
Integer |
Definition Total execution time ranges Range N/A |
Example Requests
Exporting the quantity trend of slow query logs
GET https://das.cn-north-1.myhuaweicloud.com/v3/054c630ff780d4cc2f40c00d7f6fb21d/instances/6243b3fcf2f948578d46ed4c52fb54eein01/slow-sql-trend?startAt=1719862675886&endAt=1719905875886&datastore_type=MySQL&offset=0&limit=10
Example Responses
Status code: 200
Successful response
{
"slow_sql_trend_items": [
{
"timestamp": 1719900000000,
"slow_log_count": 10
},
{
"timestamp": 1719903600000,
"slow_log_count": 11
}
],
"interval_millis": 3600000,
"total_count": 2
}
Status Codes
|
Status Code |
Description |
|---|---|
|
200 |
Successful response |
|
400 |
Client error |
|
500 |
Server error |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank 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