(Recommended) Querying Database Error Logs
Function
This API is used to query the latest 2,000 error logs of a DB instance.
- Before calling this API, learn how to authenticate it.
- Before calling this API, learn about the request header parameters.
Authorization Information
- If you are using role/policy-based authorization, see Permissions and Supported Actions for details on the required permissions.
- 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 |
|---|---|---|---|---|---|
| rds:log:getErrorLogs | read | - | - | rds:log:list | - |
URI
- URI format
GET /v3/{project_id}/instances/{instance_id}/errorlog?start_date={start_date}&end_date={end_date}
- Parameter description
Table 1 Parameters Parameter
Mandatory
Description
project_id
Yes
Definition
Project ID of a tenant in a region.
To obtain the value, see Obtaining a Project ID.
Constraints
N/A
Range
N/A
Default Value
N/A
instance_id
Yes
Definition
Instance ID.
You can obtain the value of this parameter from id in Table 4 by calling the API for querying DB instances.
Constraints
N/A
Range
N/A
Default Value
N/A
start_date
Yes
Definition
Start time.
Constraints
N/A
Range
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. For example, in the Beijing time zone, the time zone offset is shown as +0800. The start time cannot be more than one month earlier than the current time.
Default Value
N/A
end_date
Yes
Definition
End time.
Constraints
N/A
Range
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. For example, in the Beijing time zone, the time zone offset is shown as +0800. Only error logs generated within the past month can be queried.
Default Value
N/A
offset
No
Definition
Page offset.
Constraints
N/A
Range
For example, 1, 2, 3, or 4
Default Value
1
limit
No
Definition
Number of records (query results) displayed on each page.
Constraints
N/A
Range
An integer ranging from 1 to 100
Default Value
10
level
No
Definition
Log level.
Constraints
N/A
Range
Enumerated values:
- ALL
- INFO
- LOG
- WARNING
- ERROR
- FATAL
- PANIC
- NOTE
Default Value
ALL
Request
Response
- Normal response
Table 2 Parameters Parameter
Type
Description
error_log_list
Array of objects
Definition
Indicates detailed information.
For details, see Table 3.
total_record
Integer
Definition
Indicates the total number of records.
Range
N/A
- Example normal response
{ "error_log_list": [{ "time": "2018-12-04T14:24:42", "level": "WARNING", "content": "Occur error when reading bytes from a network handler. Client actively closes the connection." }, { "time": "2018-12-04T14:24:42", "level": "WARNING", "content": "Occur error when reading bytes from a network handler. Client actively closes the connection." }], "total_record": 2 } - Abnormal Response
For details, see Abnormal Response Results.
Status Code
- Normal
- Abnormal
For details, see Status Codes.
Error Code
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