(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 request header parameters.
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
Project ID of a tenant in a region.
To obtain the value, see Obtaining a Project ID.
instance_id
Yes
Specifies the ID of the queried DB instance.
start_date
Yes
Start time 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.
end_date
Yes
End time 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.
You can only query error logs generated within a month.
offset
No
Page offset, such as 1, 2, 3, or 4. The parameter value is 1 by default if it is not specified.
limit
No
Number of records on each page. Its value range is from 1 to 100. The parameter value is 10 by default if it is not specified.
level
No
Log level. The default value is ALL. Valid values:
- ALL
- INFO
- LOG
- WARNING
- ERROR
- FATAL
- PANIC
- NOTE
Response
- Normal response
Table 2 Parameters Parameter
Type
Description
error_log_list
Array of objects
Indicates detailed information.
For details, see Table 3.
total_record
Integer
Indicates the total number of records.
- 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 Request Results.
Status Code
- Normal
- Abnormal
For details, see Status Codes.
Error Code
For details, see Error Codes.