DescribeAuditLogs

更新时间:
复制 MD 格式

This API allows you to query data audit alarm logs to find and handle alarms.

Operation description

Before calling this API, ensure you meet the following prerequisites:

  • We recommend using the latest version of the Alibaba Cloud or DAS SDK.

  • When using an SDK to call the DAS service, set the region to 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

No authorization for this operation. If you encounter issues with this operation, contact technical support.

Request parameters

Parameter

Type

Required

Description

Example

Lang

string

No

The language of the request and response. Default value: zh-CN. Valid values:

  • zh-CN: Chinese.

  • en-US: English.

zh-CN

UserName

string

No

The username.

admin

ClientIp

string

No

The client IP address.

11.26.118.7

ClientUa

string

No

The client type.

mysql

InstanceName

string

No

The name of the instance.

rm-t4ni1cezz5y3xxxx

DatabaseName

string

No

The name of the database.

TestDB

StartTime

integer

No

The start time for the query, specified as a UNIX timestamp in milliseconds.

1608888296000

EndTime

integer

No

The end time for the query, specified as a UNIX timestamp in milliseconds.

15682887991222

ProductCode

string

No

The name of the database service that the data asset belongs to. Examples: RDS, PolarDB, and PolarDB-X.

RDS

ProductId

integer

No

The ID of the database service. Valid values:

  • 3: AnalyticDB for MySQL

  • 5: RDS

  • 7: PolarDB-X

  • 8: PolarDB

  • 9: AnalyticDB for PostgreSQL

  • 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 milliseconds.

in[1000 2000]

EffectRowRange

string

No

The range for the number of affected rows.

in[1 33]

RuleID

string

No

The rule ID.

9953411

RuleName

string

No

The rule name.

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 to return per page. The default is 10.

30

CurrentPage

integer

No

The page number to return.

3

RuleCategory

string

No

The rule type.

10

LoadWhiteList

boolean

No

Specifies whether to retrieve the whitelist status.

false

IpType

string

No

The network type. Valid values:

  • default: A non-Alibaba Cloud service. This is the default value.

  • aliyun: An Alibaba Cloud service.

aliyun

LogSource

string

No

The data source.

SLOW_SQL

RuleAggQuery

boolean

No

Whether to perform an aggregate query.

true

RuleId

string

No

The rule ID.

867028

Response elements

Element

Type

Description

Example

object

The response parameters.

AsyncRequestId

string

The request ID.

3926fba5-1774-44f4-af2d-ac7b33e86c3b

CurrentPage

integer

The current page number.

1

PageSize

integer

The number of entries per page.

10

RequestId

string

The request ID.

A7021857-AFD9-5AD6-979D-AA7DFC5AFADF

TotalCount

integer

The total number of entries. This parameter is valid only for Redis.

12

Items

array<object>

The details of the audit logs.

object

An audit log entry.

CreationTime

integer

The time when the alert was generated, as a UNIX timestamp in milliseconds.

1536751124000

WarnLevel

string

The risk level. Valid values:

  • 1: Low

  • 2: Medium

  • 3: High

1

ClientPort

string

The client port number.

53815

TableName

string

The name of the table.

it_table

EffectRow

integer

The number of affected rows.

10

PackageName

string

The name of the MaxCompute package.

test01

UserId

string

The user ID (UID).

19********94

Message

string

The raw log content.

success

RuleId

string

The ID of the audit rule.

9953411

OperateType

string

The operation type.

Drop

LogTime

integer

The time when the operation was executed, as a UNIX timestamp in milliseconds.

1751870592000

WarnLevelName

string

The name of the risk level.

  • Low

  • Medium

  • High

1

InstanceName

string

The alias of the instance.

test-instance-003

DatabaseName

string

The name of the database.

chngc_b2b_migration_sh

OssObjectKey

string

The key of the OSS object.

N.A

ExecuteStatus

integer

The execution status, where 0 indicates failure and 1 indicates success.

1

ProductId

integer

The ID of the database service. Valid values:

  • 3: AnalyticDB for MySQL

  • 5: RDS

  • 7: PolarDB-X

  • 8: PolarDB

  • 9: AnalyticDB for PostgreSQL

  • 11: MongoDB

  • 25: Redis

5

ExecuteTime

integer

The execution duration, in milliseconds.

1751870592000

UserName

string

The username.

admin

InstanceDescription

string

The description of the instance.

instance dscription

RuleName

string

The name of the audit rule.

name

ColumnName

string

The column name.

ds

ClientIp

string

The client's IP address.

100.104.16.251

ClientUa

string

The client's user agent.

mysql

Id

integer

The primary key of the log entry.

1

ProductCode

string

The name of the database service, such as RDS, PolarDB, and PolarDB-X 2.0.

RDS

SqlText

string

The SQL statement.

select * from test03

InWhiteList

boolean

Indicates whether the alert is in the whitelist.

True

IpType

string

The network type. Valid values:

default: A non-Alibaba Cloud service. This is the default.

aliyun: An Alibaba Cloud service.

aliyun

RuleCategory

string

The rule category.

10

LogSource

string

The data source.

SLOW_SQL

InstanceAuditStatus

string

The audit status of the instance.

2

Examples

Success response

JSON format

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

Error codes

HTTP status code

Error code

Error message

Description

400 InvalidParams The request parameters are invalid.
403 NoPermission You are not authorized to do this action.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.