Obtaining Links for Downloading Slow Query Logs¶
Function¶
This API is used to obtain links for downloading slow query logs.
Before calling an API, you need to understand the API in Authentication.
Before calling this API, obtain the required region and endpoint.
Description¶
You need to do this API in two steps:
For MySQL and PostgreSQL:
Sent empty object "{}" in request body, in order to initiate exporting of download link.
Repeat 1 with same "{}" to receive download link.
For SQLServer:
Sent "file_name": "SQLTrace.trc" in request body, in order to initiate exporting of download link.
Repeat 1 with same "file_name": "SQLTrace.trc" to receive download link.
URI¶
URI format
POST https://{Endpoint}/v3/{project_id}/instances/{instance_id}/slowlog-download
Parameter description
¶ Name
Mandatory
Description
project_id
Yes
Specifies the project ID of a tenant in a region.
For details about how to obtain the project ID, see Obtaining a Project ID.
instance_id
Yes
Specifies the ID of the DB instance to be queried.
Request¶
Parameter description
¶ Name
Mandatory
Type
Description
file_name
No
String
Specifies the name of the file to be downloaded.
This parameter is mandatory for SQL Server.
The value is SQLTrace.trc
Example
Request example
For MySQL and PostgreSQL:
step 1 request:
{}
step 2 request:
{}
For SQLServer:
step 1 request:
{ "file_name":"SQLTrace.trc" }
step 2 request:
{ "file_name":"SQLTrace.trc" }
Response¶
Normal response
¶ Name
Type
Description
list
List
Indicates the links for downloading slow query logs. For details, see Table 4.
status
String
Indicates the status of generating links for downloading slow query logs.
FINISH: The download link has been generated.
CREATING: A file is being generated and the download link is to be prepared.
FAILED: Log files fail to be prepared.
count
Integer
Indicates the number of links for downloading slow query logs.
¶ Name
Type
Description
workflow_id
String
Indicates the workflow ID.
file_name
String
Indicates the name of the generated file for downloading slow query logs.
status
String
Indicates the generation status of the current link.
EXPORTING: The download link is being generated.
SUCCESS: The download link is successfully generated.
FAILED: The download link failed to be generated.
file_size
String
Indicates the file size.
file_link
String
Indicates the download link.
This link is valid for 5 minutes.
create_at
Long
Indicates the generation time.
Example normal response
Generating the link for downloading slow query logs:
{ "list": [ { "workflow_id": "0202bf1a-4181-48b9-bdd8-27ea4cef05b2", "file_name": "054bc98b0a80d39b1faec01373f2f339_slowlog_download_20211117091141667", "status": "EXPORTING", "create_at": 1637140301659 } ], "status": "CREATING", "count": 1 }
Link for downloading slow query logs obtained successfully:
{ "list": [ { "workflow_id": "0202bf1a-4181-48b9-bdd8-27ea4cef05b2", "file_name": "054bc98b0a80d39b1faec01373f2f339_slowlog_download_20211117091141667", "status": "SUCCESS", "file_size": "922", "file_link": "https://rdsbucket.opxxx.svc.rds.xxxxx", "create_at": 1637140315066 } ], "status": "FINISH", "count": 1 }
Abnormal response
For details, see Abnormal Request Results.
Status Code¶
Normal
200
Abnormal
For details, see Status Codes.
Error Code¶
For details, see Error Codes.