DescribeAuditLogs

Updated at:

Queries the list of data audit alert logs to facilitate alert search and processing.

Operation description

To use this operation, you must meet the following prerequisites:

  • When using the Alibaba Cloud or DAS SDK, use the latest version.

  • When using the SDK to call DAS, specify the region as cn-shanghai.

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

hdm:DescribeAuditLogs

list

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

Lang

string

No

The language type of the request and response messages. Default value: zh_cn. Valid values:

  • zh_cn: Chinese.

  • en_us: English.

zh-CN

UserName

string

No

The username.

admin

ClientIp

string

No

The IP address of the client that sends the request.

11.26.118.7

ClientUa

string

No

The client type.

mysql

InstanceName

string

No

The name of the asset instance.

rm-t4ni1cezz5y3xxxx

DatabaseName

string

No

The name of the database.

TestDB

StartTime

integer

No

The start time of the alert logs. Unit: milliseconds.

1608888296000

EndTime

integer

No

The end time of the alert logs. The value is a UNIX timestamp in milliseconds.

15682887991222

ProductCode

string

No

The name of the product to which the data asset belongs. Valid values include RDS, PolarDB, and PolarDB-X 2.0.

RDS

ProductId

integer

No

The ID of the product to which the data object belongs. Valid values:

  • 3: ADB-MYSQL

  • 5: RDS

  • 7: PolarDB-X

  • 8: PolarDB

  • 9: ADB-PG

  • 11: MongoDB

  • 25: Redis

5

SqlText

string

No

The content of the SQL statement.

SELECT * FROM test where name = 'das'

ExecuteTimeRange

string

No

The execution time range.

in[1000 2000]

EffectRowRange

string

No

The range of affected rows.

in[1 33]

RuleName

string

No

The name of the audit rule.

test_rule

OperateType

string

No

The operation type.

Insert

OssObjectKey

string

No

The key of the OSS object.

N.A

AsyncRequestId

string

No

The request ID.

2c548e83-1473-4fda-b3dc-5a189074ead5

PageSize

integer

No

The maximum number of entries per page. Default value: 10.

30

CurrentPage

integer

No

The current page number.

3

RuleCategory

string

No

The rule type.

10

LoadWhiteList

boolean

No

Specifies whether to load the whitelist status.

false

IpType

string

No

The network type. Valid values:

  • default: Non-Alibaba Cloud services. This is the default value.

  • aliyun: Alibaba Cloud services.

aliyun

LogSource

string

No

The data source.

SLOW_SQL

RuleAggQuery

boolean

No

Specifies whether to perform an aggregate query.

true

RuleId

string

No

The rule ID.

867028

LogQueryOpJson

string

No

Response elements

Element

Type

Description

Example

object

AsyncRequestId

string

The request ID.

3926fba5-1774-44f4-af2d-ac7b33e86c3b

CurrentPage

integer

The current page number.

1

Items

array<object>

The IP addresses of the clients in the SQL log records.

object

The physical asynchronous read.

ClientIp

string

The IP address of the client in the query.

100.104.16.251

ClientPort

string

The port number of the client in the query.

53815

ClientUa

string

The client type.

mysql

ColumnName

string

The column name.

ds

CreationTime

integer

The alert time. Unit: milliseconds.

1536751124000

DatabaseName

string

The database name.

chngc_b2b_migration_sh

EffectRow

integer

The number of affected rows.

10

ExecuteStatus

integer

The execution status. Valid values: 0: Failed. 1: Successful.

1

ExecuteTime

integer

The execution duration. Unit: milliseconds.

1751870592000

Id

integer

The primary key ID.

1

InWhiteList

boolean

Indicates whether the alert is in the whitelist.

True

InstanceAuditStatus

string

The instance audit status.

2

InstanceDescription

string

The description of the data asset instance.

instance dscription

InstanceName

string

The instance alias.

test-instance-003

IpType

string

The network type. Valid values:

default: Non-Alibaba Cloud services. This is the default value.

aliyun: Alibaba Cloud services.

aliyun

LogSource

string

The data source.

SLOW_SQL

LogTime

integer

The log execution time. The value is a UNIX timestamp in milliseconds.

1751870592000

Message

string

The raw log content.

success

OperateType

string

The operation type.

Drop

OssObjectKey

string

The key of the OSS object.

N.A

PackageName

string

The MaxCompute package name.

test01

ProductCode

string

The name of the product to which the data asset belongs. Valid values include RDS, PolarDB, and PolarDB-X 2.0.

RDS

ProductId

integer

The ID of the product to which the data object belongs. Valid values:

  • 3: ADB-MYSQL

  • 5: RDS

  • 7: PolarDB-X

  • 8: PolarDB

  • 9: ADB-PG

  • 11: MongoDB

  • 25: Redis

5

RuleCategory

string

The rule type.

10

RuleId

string

The audit rule ID.

9953411

RuleName

string

The name of the audit rule.

name

SqlText

string

The SQL statement.

select * from test03

TableName

string

The name of the table used in the query.

it_table

UserId

string

The user UID.

19********94

UserName

string

The username.

admin

WarnLevel

string

The risk level. Valid values:

  • 1: Low risk.

  • 2: Medium risk.

  • 3: High risk.

1

WarnLevelName

string

The risk level name. Valid values:

  • Low risk.

  • Medium risk.

  • High risk.

1

PageSize

integer

The number of entries per page in the paged query.

10

RequestId

string

The request ID.

A7021857-AFD9-5AD6-979D-AA7DFC5AFADF

TotalCount

integer

The total number of records. This parameter is valid only for the Redis engine.

12

Examples

Success response

JSON format

{
  "AsyncRequestId": "3926fba5-1774-44f4-af2d-ac7b33e86c3b",
  "CurrentPage": 1,
  "Items": [
    {
      "ClientIp": "100.104.16.251",
      "ClientPort": "53815",
      "ClientUa": "mysql",
      "ColumnName": "ds",
      "CreationTime": 1536751124000,
      "DatabaseName": "chngc_b2b_migration_sh",
      "EffectRow": 10,
      "ExecuteStatus": 1,
      "ExecuteTime": 1751870592000,
      "Id": 1,
      "InWhiteList": true,
      "InstanceAuditStatus": "2",
      "InstanceDescription": "instance dscription",
      "InstanceName": "test-instance-003",
      "IpType": "aliyun",
      "LogSource": "SLOW_SQL",
      "LogTime": 1751870592000,
      "Message": "success",
      "OperateType": "Drop",
      "OssObjectKey": "N.A",
      "PackageName": "test01",
      "ProductCode": "RDS",
      "ProductId": 5,
      "RuleCategory": "10",
      "RuleId": "9953411",
      "RuleName": "name",
      "SqlText": "select * from test03",
      "TableName": "it_table",
      "UserId": "19********94",
      "UserName": "admin",
      "WarnLevel": "1",
      "WarnLevelName": "1"
    }
  ],
  "PageSize": 10,
  "RequestId": "A7021857-AFD9-5AD6-979D-AA7DFC5AFADF",
  "TotalCount": 12
}

Error codes

HTTP status code

Error code

Error message

Description

400 InvalidParams The request parameters are invalid. The request parameters are invalid.
403 NoPermission You are not authorized to do this action. You do not have the permission to perform this operation.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.