Querying Error Logs Through LTS
Function
This API is used to query error logs of a DB instance when Log Tank Service (LTS) is available in the current region.
- 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
- 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
Request
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| start_time | Yes | String | 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_time | Yes | String | 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 |
| level | No | String | Definition Log level. Constraints N/A Range Enumerated values:
Default Value ALL |
| line_num | No | String | Definition Sequence number of a log line. Constraints This parameter is not required for the first query, but is required for subsequent pagination queries. The value can be obtained from the response of the last query. Range The value of line_num should be between the values of start_time and end_time. Default Value N/A |
| search_type | No | String | Definition Search mode. This parameter is used together with line_num. Constraints N/A Range
Default Value forwards |
| limit | No | Integer | Definition Number of records (query results) displayed on each page. Constraints N/A Range An integer ranging from 1 to 100 Default Value 10 |
Example Request
POST https://{endpoint}/v3/0483b6b16e954cb88930a360d2c4e663/instances/cee5265e1e5845649e354841234567dfin01/error-logs
{
"start_time":"2023-01-05T08:00:00+0800",
"end_time":"2023-01-11T20:00:00+0800",
"limit":10,
"line_num":"1672908793000000000",
"search_type":"forwards"
} Response
- Normal response
Table 3 Parameters Parameter
Type
Description
error_log_list
Array of objects
Definition
Error logs.
For details, see Table 4.
Table 4 error_log_list field data structure description Parameter
Type
Description
time
String
Definition
Time in the UTC format.
Range
N/A
level
String
Definition
Log level.
Range
- INFO
- LOG
- WARNING
- ERROR
- FATAL
- PANIC
- NOTE
content
String
Definition
Error log content.
Range
N/A
line_num
String
Definition
Sequence number of a log line.
Range
N/A
- Example normal response
{ "error_log_list" : [ { "time" : "2022-08-23T22:59:17Z", "level" : "WARNING", "content" : "Occur error when reading bytes from a network handler. Client actively closes the connection.", "line_num" : "1595659490239433658" } ] } - 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