All Products
Search
Document Center

Tair (Redis® OSS-Compatible):DescribeAuditRecords

Last Updated:Oct 12, 2026

Queries the audit logs of an ApsaraDB for Tair (Redis® OSS-Compatible) database instance.

Operation description

When you call this operation, the audit log feature must be enabled 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 the node in the instance. Specify this parameter to query the monitoring information of a specific node.

Note
  • This parameter is available only when the instance uses the read/write splitting or cluster architecture.

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

r-bp1zxszhcgatnx****-db-0

AccountName

string

No

The name of the account. If you do not specify this parameter, the audit logs of all accounts are queried.

demo

DatabaseName

string

No

The database in the instance. If you do not specify this parameter, the audit logs of all databases are queried. Valid values: 0 to 255. For example, 0 indicates database 0.

0

QueryKeywords

string

No

The keyword used to query audit logs based on a specific command. By default, the audit logs of all executed commands are queried.

Note

You can specify only one keyword.

maxclients

HostAddress

string

No

The IP address of the client. If you do not specify this parameter, the audit logs of all IP addresses are queried.

127.0.0.1

PageSize

integer

No

The maximum number of entries to return on each page.

Valid values:

  • 30 :

    30 entries per page.

  • 50 :

    50 entries per page.

  • 100 :

    100 entries per page.

30

PageNumber

integer

No

The page number of the page to return.

1

StartTime

string

Yes

The start time of the 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 time of the 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

Because audit logs contain a large number of entries, specify a time range of up to 10 minutes and a maximum of 1 day.

2019-03-25T12:10:00Z

Response elements

Element

Type

Description

Example

object

EndTime

string

The end time of the query.

The time is in the YYYY-MM-DDTHH:mm:ssZ format and displayed in UTC.

2019-03-25T12:10:00Z

StartTime

string

The start time of the query.

The time is in the YYYY-MM-DDTHH:mm:ssZ format and displayed in UTC.

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 entries.

22222

PageNumber

integer

The page number of the page to return.

1

PageSize

integer

The maximum number of entries to return on each page.

30

Items

object

SQL

array<object>

The collection of audit log entries.

object

HostAddress

string

The IP address of the client.

127.0.0.1

SQLText

string

The command record.

CONFIG GET maxmemory

DatabaseName

string

The name of the database.

demo

SQLType

string

The type of the command.

non_read_write

ExecuteTime

string

The execution time.

The time is in the YYYY-MM-DDTHH:mm:ssZ format and displayed in UTC.

2019-03-25T03:22:08Z

TotalExecutionTimes

string

The execution duration.

0

NodeId

string

The ID of the node.

Note

This parameter is returned only when the instance uses the cluster or read/write splitting architecture.

r-bp1zxszhcgatnx****-db-0

AccountName

string

The name of the account.

demo

IPAddress

string

The IP address.

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.