All Products
Search
Document Center

Tair (Redis® OSS-Compatible):DescribeAuditRecords

Last Updated:Aug 28, 2026

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

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

kvstore:DescribeAuditRecords

get

*DBInstance

acs:kvstore:{#regionId}:{#accountId}:instance/{#instanceId}

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
  • This parameter is available only for read/write splitting and cluster instances.

  • You can call the DescribeLogicInstanceTopology operation to query node IDs.

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.