Queries the audit logs of a Tair (Redis OSS-compatible) instance.
Operation description
Before you call this operation, you must enable the audit log feature for the instance. For more information, see ModifyAuditLogConfig.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
kvstore:DescribeAuditRecords |
get |
*DBInstance
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| InstanceId |
string |
Yes |
The ID of the instance. |
r-bp1zxszhcgatnx**** |
| NodeId |
string |
No |
The ID of a node in the instance. Specify this parameter to query the monitoring data of a specific node. Note
|
r-bp1zxszhcgatnx****-db-0 |
| AccountName |
string |
No |
The username of the account. If not specified, all accounts of the instance are queried. |
demo |
| DatabaseName |
string |
No |
The name of the database in the instance. If not specified, all databases are queried. Valid values: 0 to 255. 0 specifies database 0. |
0 |
| QueryKeywords |
string |
No |
The keyword used to filter audit logs. You can specify a command as a keyword. By default, all commands are queried. Note
You can specify only a single keyword in each call. |
maxclients |
| HostAddress |
string |
No |
The IP address of the client. If not specified, logs from all clients are returned. |
127.0.0.1 |
| PageSize |
integer |
No |
The number of entries to return on each page. |
30 |
| PageNumber |
integer |
No |
The number of the page to return. |
1 |
| StartTime |
string |
Yes |
The start of the time range to query. Specify the time in the yyyy-MM-ddTHH:mm:ssZ format. The time must be in UTC. |
2019-03-24T12:10:00Z |
| EndTime |
string |
Yes |
The end of the time range to query. The end time must be later than the start time. Specify the time in the yyyy-MM-ddTHH:mm:ssZ format. The time must be in UTC. Note
Specify a time range of 10 minutes or less because audit logs can contain a large number of entries. Do not specify a time range longer than one day. |
2019-03-25T12:10:00Z |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| EndTime |
string |
The end time of the query. |
2019-03-25T12:10:00Z |
| StartTime |
string |
The start time of the query. |
2019-03-24T12:10:00Z |
| RequestId |
string |
The ID of the request. |
9F5EB478-824E-4AC4-8D2B-58F31A02**** |
| InstanceName |
string |
The name of the instance. |
r-bp1zxszhcgatnx**** |
| TotalRecordCount |
integer |
The total number of returned entries. |
22222 |
| PageNumber |
integer |
The page number of the returned page. |
1 |
| PageSize |
integer |
The maximum number of entries returned per page. |
30 |
| Items |
object |
||
| SQL |
array<object> |
The returned audit log entries. |
|
|
object |
|||
| HostAddress |
string |
The IP address of the client. |
127.0.0.1 |
| SQLText |
string |
The command that was run. |
CONFIG GET maxmemory |
| DatabaseName |
string |
The database name. |
demo |
| SQLType |
string |
The type of the command. |
non_read_write |
| ExecuteTime |
string |
The time when the command was run. |
2019-03-25T03:22:08Z |
| TotalExecutionTimes |
string |
The time consumed to run the command. |
0 |
| NodeId |
string |
The ID of the node. Note
A specific node ID is returned only if the instance uses the cluster or read/write splitting architecture. |
r-bp1zxszhcgatnx****-db-0 |
| AccountName |
string |
The username of the account. |
demo |
| IPAddress |
string |
The IP address of the instance. |
192.16.100.*** |
Examples
Success response
JSON format
{
"EndTime": "2019-03-25T12:10:00Z",
"StartTime": "2019-03-24T12:10:00Z",
"RequestId": "9F5EB478-824E-4AC4-8D2B-58F31A02****",
"InstanceName": "r-bp1zxszhcgatnx****",
"TotalRecordCount": 22222,
"PageNumber": 1,
"PageSize": 30,
"Items": {
"SQL": [
{
"HostAddress": "127.0.0.1",
"SQLText": "CONFIG GET maxmemory",
"DatabaseName": "demo",
"SQLType": "non_read_write",
"ExecuteTime": "2019-03-25T03:22:08Z",
"TotalExecutionTimes": "0",
"NodeId": "r-bp1zxszhcgatnx****-db-0",
"AccountName": "demo",
"IPAddress": "192.16.100.***"
}
]
}
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | IncorrectDBInstance.NotSupported | This instance do not support log audit. | This instance does not support audit log related services |
| 400 | InvalidEndTime.Invalid | pecified end time is before this service active time. | |
| 400 | InvalidStartTime.Malformed | The Specified parameter StartTime is not valid. | |
| 400 | InvalidEndTime.Malformed | The Specified parameter EndTime is not valid. | |
| 400 | InvalidPageSize.Malformed | The specified parameter PageSize is not valid. | |
| 400 | InvalidPageNumbers.Malformed | Specified page number is not valid. | |
| 400 | InvalidQueryTime.Format | Specified query time is not valid. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.