Querying Slow Query Logs of a GeminiDB Redis Instance
Function
This API is used to query slow query logs of GeminiDB Redis instances. Searching for slow query logs by keyword is supported.
Constraints
- Operators &&, ||, AND, OR, NOT, *, ?, :, >, <, =, >=, and <= cannot be used to search for logs.
- The query must be within the period specified by start_time and end_time.
- The value of line_num must be obtained from the log information returned for the last query. This parameter is optional for the first query.
- A maximum of 100 records can be queried on each page, and slow query logs can be stored for a maximum of 30 days.
Authorization Information
Each account has permissions to call all APIs, but IAM users must have the required permissions specifically assigned.
- If you are using role/policy-based authorization, see the required permissions in Permissions and Supported Actions.
- 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
gaussdbfornosql:instance:listSlowLog
List
instance *
- g:ResourceTag/<tag-key>
- g:EnterpriseProjectId
nosql:instance:list
-
URI
POST /v3/{project_id}/redis/instances/{instance_id}/slow-logs
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
project_id |
Yes |
String |
Explanation: Project ID of a tenant in a region. To obtain this value, see Obtaining a Project ID. Constraints: N/A Values: N/A Default value: N/A |
|
instance_id |
Yes |
String |
Explanation: Instance ID Constraints: N/A Values: N/A Default value: N/A |
Request Parameters
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
X-Auth-Token |
Yes |
String |
Definition User token You can obtain the token by calling the IAM API by following Obtaining a User Token Through Password Authentication. Constraints N/A Range N/A Default value: N/A |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
start_time |
Yes |
String |
Definition Start time Constraints: The start time cannot be 30 days earlier than the current time. Range Format: yyyy-mm-ddThh:mm:ssZ T is the separator between calendar and hourly notation of time. Z indicates the time zone offset. Default value: N/A |
|
end_time |
Yes |
String |
Definition End time Constraints: The end time cannot be later than the current time. Range Format: yyyy-mm-ddThh:mm:ssZ T is the separator between calendar and hourly notation of time. Z indicates the time zone offset. Default value: N/A |
|
limit |
Yes |
Integer |
Explanation: Number of logs queried each time Constraints: N/A Values: 1 to 100 Default value: N/A |
|
line_num |
No |
String |
Explanation: Sequence number of a single log line. The current query starts from the next log of line_num, excluding the log of line_num. Constraints: This parameter is not required for the first query. The value can be obtained from the response of the last query. Values: N/A Default value: N/A |
|
operate_type |
No |
String |
Explanation: Statement type Constraints: N/A Values: If this parameter is left blank, all statement types are queried. The following statement types can be queried: SET, GET, DEL, INCR, INCRBY, INCRBYFLOAT, DECR, DECRBY, GETSET, APPEND, MGET, KEYS, SETNX, SETEX, PSETEX, DELVX, MSET, MSETNX, GETRANGE, SUBSTR, SETRANGE, STRLEN, EXISTS, EXPIRE, PEXPIRE, EXPIREAT, PEXPIREAT, TTL, PTTL, PERSIST, TYPE, SCANX, PKSETEXAT, SORT, HDEL, HSET, HGET, HGETALL, HEXISTS, HINCRBY, HINCRBYFLOAT, HKEYS, HLEN, HMGET, HMSET, HSETNX, HSTRLEN, HVALS, HSCAN, HSCANX, PKHSCANRANGE, PKHRSCANRANGE, LINDEX, LINSERT, LLEN, LPOP, LPUSH, LPUSHX, LRANGE, LREM, LSET, LTRIM, RPOP, RPOPLPUSH, RPUSH, RPUSHX, ZADD, ZCARD, ZSCAN, ZINCRBY, ZRANGE, ZREVRANGE, ZRANGEBYSCORE, ZREVRANGEBYSCORE, ZCOUNT, ZREM, ZUNIONSTORE, ZINTERSTORE, ZRANK, ZREVRANK, ZSCORE, ZRANGEBYLEX, ZREVRANGEBYLEX, ZLEXCOUNT, ZREMRANGEBYRANK, ZREMRANGEBYSCORE, ZREMRANGEBYLEX, ZPOPMAX, ZPOPMIN, SADD, SPOP, SCARD, SMEMBERS, SSCAN, SREM, SUNION, SUNIONSTORE, SINTER, SINTERSTORE, SISMEMBER, SDIFF, SDIFFSTORE, SMOVE, SRANDMEMBER, BITSET, BITGET, BITCOUNT, BITPOS, BITOP, BITFIELD, PFADD, PFCOUNT, PFMERGE, GEOADD, GEORADIUSBYMEMBER, GEORADIUS, GEOHASH, GEODIST, GEOPOS, XADD, XACK, XGROUP, XDEL, XTRIM, XLEN, XRANGE, XREVRANGE, XCLAIM, XPENDING, XINFO, XREAD, and XREADGROUP Default value: N/A |
|
node_id |
No |
String |
Explanation: Node ID Constraints: N/A Values: If this parameter is left blank, all nodes in the instance can be queried. For details about the value, see field id in Table 10. Default value: N/A |
|
keywords |
No |
Array of strings |
Explanation: Full-text log search based on multiple keywords, indicating that all keywords are matched. Constraints:
|
|
max_cost_time |
No |
Double |
Explanation: Logs can be searched based on the maximum execution duration. The unit is millisecond. Constraints: N/A Values: N/A Default value: N/A |
|
min_cost_time |
No |
Double |
Explanation: Logs can be searched based on the minimum execution duration. The unit is millisecond. Constraints: N/A Values: N/A Default value: N/A |
Response Parameters
Status code: 200
|
Parameter |
Type |
Description |
|---|---|---|
|
slow_logs |
Array of objects |
Explanation: Slow log information. For details, see Table 5. |
|
Parameter |
Type |
Description |
|---|---|---|
|
node_name |
String |
Explanation: Node name Range N/A |
|
node_id |
String |
Explanation: Node ID Values: N/A |
|
whole_message |
String |
Explanation: Statement Values: N/A |
|
operate_type |
String |
Explanation: Statement type Values: N/A |
|
cost_time |
Double |
Explanation: Execution time (ms) Range N/A |
|
log_time |
String |
Explanation: UTC time when a log is generated Range The format is yyyy-mm-ddThh:mm:ssZ. T is the separator between calendar and hourly notation of time. Z indicates the time zone offset. |
|
line_num |
String |
Explanation: Sequence number of a log event. Range N/A |
Example Requests
POST
https://{Endpoint}/v3/619d3e78f61b4be68bc5aa0b59edcf7b/redis/instances/a6d3c8a9857b4c81b3c1fe4802dfa4d0in12/slow-logs
{
"start_time" : "2022-09-06T10:41:14+0800",
"end_time" : "2022-09-16T10:41:14+0800",
"limit" : 100,
"line_num" : "1595659490239433658",
"operate_type" : "set",
"node_id" : "2997329fe3cb4b3faedcade16df6966eno12",
"keywords" : [ "log", "test" ],
"max_cost_time" : 100.12,
"min_cost_time" : 50.12
}
Example Responses
Status code: 200
Successful response
{
"slow_logs": [{
"node_name": "test_worker_node_1",
"node_id": "dbd0b65ed0c34125a0b04d4e5ba67e66no02",
"whole_message": "testDb",
"operate_type": "SET",
"cost_time": 60.12,
"log_time": "2022-09-15T22:49:38.643000Z",
"line_num": "1595659490239433659"
}]
}
Status Codes
For details, see Status Codes.
Error Codes
For details, see Error Codes.
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