Querying Database Error Logs (New)
API Description
This API is used to query database error logs.
Restrictions
- Operators &, ||, AND, OR, NOT, *, ?, :, >, <, =, ≥, and ≤ cannot be used to search for logs.
- A maximum of 100 records can be queried on each page, and logs can be stored for a maximum of 30 days.
|
Name |
Type |
IN |
Mandatory |
Description |
|---|---|---|---|---|
|
project_id |
string |
path |
Yes |
Project ID of a tenant in a region. To obtain the project ID, see Obtaining a Project ID. |
|
instance_id |
string |
path |
Yes |
Instance ID, which can be obtained by calling the API described in Querying Instances and Details. If you do not have an instance, call the API described in Creating a DB Instance to create one. |
Request Parameters
|
Parameter |
Type |
IN |
Mandatory |
Description |
|---|---|---|---|---|
|
X-Auth-Token |
string |
header |
Yes |
User token |
|
Parameter |
Type |
Mandatory |
Description |
|---|---|---|---|
|
start_time |
String |
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.
CAUTION:
The start time cannot be 30 days earlier than the current time. |
|
end_time |
String |
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.
NOTE:
The end time cannot be later than the current time. |
|
limit |
Integer |
Yes |
Number of logs to be queried each time. The maximum value is 100. |
|
line_num |
String |
No |
Sequence number of a log event. This parameter is not required for the first query, but is required for the next page query. The value can be obtained from the response of the last query. The current query starts from the next log of line_num, excluding the log of line_num. |
|
severity |
String |
No |
Log level. If this parameter is left blank, logs of all levels can be queried. The value can be:
|
|
search_type |
String |
No |
Log query mode, which must be used together with line_num. The log of line_num is used as the start point.
Enumerated values:
|
|
node_id |
String |
No |
Node ID. If this parameter is left blank, all nodes in the instance can be queried. For details, see id in Table 9. Nodes that can be queried:
|
|
keywords |
Array of strings |
No |
Full-text log search based on multiple keywords, indicating that all keywords are matched.
|
- Example request
{ "start_time" : "2023-01-06T10:41:14+0800", "end_time" : "2023-01-09T13:41:14+0800", "limit" : 100, "line_num" : "1595659490239433658", "severity" : "Warning", "search_type" : "forwards", "node_id" : "dbd0b65ed0c34125a0b04d4e5ba67e66no02", "keywords" : ["Unable", "NETWORK"] }
Response Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
error_logs |
Array of objects |
Error log details. For details, see Table 5. |
|
Parameter |
Type |
Description |
|---|---|---|
|
node_name |
String |
Node name. |
|
node_id |
String |
Node ID. |
|
raw_message |
String |
Description. |
|
severity |
String |
Log level. |
|
log_time |
String |
UTC time when a log is generated. The format is yyyy-mm-ddThh:mm:ssZ. T is the separator between the calendar and the hourly notation of time. Z indicates the time zone offset. |
|
line_num |
String |
Sequence number of a log event. |
- Example response
{ "error_logs" : [ { "node_name" : "Test_replica_node_2", "node_id" : "dbd0b65ed0c34125a0b04d4e5ba67e66no02", "raw_message" : "W NETWORK [ShardServerCatalogCacheLoader-214] Unable to reach primary for set shard_2", "severity" : "Warning", "log_time" : "2023-01-09T12:55:39.398+0000", "line_num" : "1595659490239433659" } ] }
Status Code
For details, see Status Code.
Error Code
For details, see Error Code.
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