All Products
Search
Document Center

Database Autonomy Service:GetDasSQLLogHotData

Last Updated:Oct 26, 2026

Retrieves the hot data of audit logs.

Operation description

To use this API operation, the following prerequisites must be met:

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

  • When you call DAS by using the SDK, you must set the region to cn-shanghai.

  • This API operation is applicable to PolarDB for MySQL, ApsaraDB RDS for MySQL, ApsaraDB RDS for PostgreSQL, and ApsaraDB RDS for SQL Server.

  • Log indexing is enabled for the instance.

Note

The query start time cannot be earlier than 7 days ago. The interval between the query start time and the query end time cannot exceed 1 day. This API operation returns a maximum of 10,000 records.

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:GetDasSQLLogHotData

get

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

InstanceId

string

Yes

The database instance ID.

rm-2ze1jdv45i7l6****

Start

integer

Yes

The start time of the query. The time is in the UNIX timestamp format. Unit: milliseconds.

Note

You can only query data generated after DAS Enterprise Edition is enabled. The start time cannot be more than 7 days earlier than the current time.

1684734297000

End

integer

Yes

The end time of the query. The time is in the UNIX timestamp format. Unit: milliseconds.

Note

The end time must be later than the start time, and the interval between the start time and the end time cannot exceed 1 day.

1684820697000

QueryKeyword

string

No

The keyword.

Note

Fuzzy match is supported. You can use a maximum of 10 keywords for a combined query. Separate multiple keywords with spaces. Example: a1 b2 c3.

a1 b2

AccountName

string

No

The database account.

Note

You can use multiple database accounts for a combined query. Separate multiple database accounts with spaces. Example: user1 user2 user3.

testuser

DBName

string

No

The database name.

Note

You can use multiple database names for a combined query. Separate multiple database names with spaces. Example: DB1 DB2 DB3.

testDB

HostAddress

string

No

The IP address of the client.

Note

You can use multiple client IP addresses for a combined query. Separate multiple client IP addresses with spaces. Example: IP1 IP2 IP3.

47.100.XX.XX

LogicalOperator

string

No

The logical relationship between multiple keywords. Valid values:

  • or: OR.

  • and: AND.

or

MaxLatancy

integer

No

The maximum execution duration. Unit: microseconds. This parameter is used to query SQL statements whose execution duration is less than the specified value.

100

MaxScanRows

integer

No

The maximum number of scanned rows. This parameter is used to query SQL statements whose number of scanned rows is less than the specified value.

10000

MinLatancy

integer

No

The minimum execution duration. Unit: microseconds. This parameter is used to query SQL statements whose execution duration is greater than or equal to the specified value.

10

MinScanRows

integer

No

The minimum number of scanned rows. This parameter is used to query SQL statements whose number of scanned rows is greater than or equal to the specified value.

10

SqlType

string

No

The type of the SQL statement. Valid values:

  • select

  • update

  • delete

Valid values:

  • select :

    Query.

  • update :

    Update.

  • delete :

    Delete.

select

State

string

No

The execution result. If you enter 0, the system queries SQL statements that are successfully executed. You can also enter a specific error code to query the corresponding SQL statements.

0

ThreadID

string

No

The thread ID.

Note

You can use multiple thread IDs for a combined query. Separate multiple thread IDs with spaces. Example: ThreadID1 ThreadID2 ThreadID3.

657

PageNumbers

integer

No

The page number for the paging query. Pages start from 1. Default value: 1.

2

MaxRecordsPerPage

integer

No

The maximum number of records per page for the paging query. Valid values: 5 to 100.

10

SortKey

string

No

The sort key. Valid values:

  • ScanRows: the number of scanned rows.

  • UpdateRows: the number of updated rows.

  • Consume: the execution duration.

  • OriginTime: the execution time.

  • ReturnRows: the number of returned rows.

ScanRows

SortMethod

string

No

The sort order. Valid values:

  • ASC: ascending order.

  • DESC: descending order.

ASC

ChildDBInstanceIDs

string

No

The node ID.

Note

For a PolarDB for MySQL instance, you must specify the node ID.

pi-bp179lg03445l****

Role

string

No

The reserved parameter. This parameter is not supported.

None

TraceId

string

No

The reserved parameter. This parameter is not supported.

None

MinRows

integer

No

The reserved parameter. This parameter is not supported.

None

MaxRows

integer

No

The reserved parameter. This parameter is not supported.

None

MinSpillCnt

integer

No

The reserved parameter. This parameter is not supported.

None

MaxSpillCnt

integer

No

The reserved parameter. This parameter is not supported.

None

TransactionId

string

No

The transaction ID.

0

Fail

string

No

The error code returned when the SQL statement is executed. You can call the GetAsyncErrorRequestStatByCode operation to obtain the error code.

1064

Response elements

Element

Type

Description

Example

object

Code

string

The returned HTTP status code.

200

Message

string

The returned message.

Note

If the request is successful, Successful is returned. If the request fails, an error message, such as an error code, is returned.

Successful

RequestId

string

The request ID, which is a unique identifier generated by Alibaba Cloud for the request.

0A74B755-98B7-59DB-8724-1321B394****

Success

string

Indicates whether the request is successful. Valid values:

  • true: The request is successful.

  • false: The request fails.

true

Data

object

The returned data.

List

array<object>

The list of returned information.

object

The returned SQL Explorer and audit data.

Latancy

integer

The execution duration. Unit: microseconds.

10000

Ext

string

The extended information field. This is a reserved parameter.

None

ExecuteTime

string

The execution time. The time is in the UTC format: yyyy-MM-ddTHH:mm:ssZ.

2023-05-23 T12:11:20Z

OriginTime

string

The execution time. The time is in the UTC format: yyyy-MM-ddTHH:mm:ss.SSSZ.

2023-05-23 T12:11:20.999Z

HostAddress

string

The IP address of the client.

47.100.XX.XX

UpdateRows

integer

The number of updated rows.

30

LogicRead

integer

The logical reads.

12

SQLText

string

The details of the SQL statement.

select 1

LockTime

integer

The lock wait duration. Unit: microseconds.

1

ScanRows

integer

The number of scanned rows.

29

ThreadID

integer

The thread ID.

657

State

string

The status. A value of 0 indicates that the execution is successful. Otherwise, an error code is returned.

0

DBName

string

The name of the database.

testDB

SqlType

string

The type of the SQL statement. Valid values:

  • select

  • update

  • delete

select

AccountName

string

The database account.

testuser

PhysicSyncRead

integer

The number of physical synchronous reads.

0

PhysicAsyncRead

integer

The number of physical asynchronous reads.

0

TransactionId

string

The ID of the started transaction.

0

ReturnRows

integer

The number of returned rows.

1

NodeId

string

The node ID.

pi-bp120roy76f3qbd84

Total

integer

The total number of returned records.

20

PageNo

integer

The page number.

2

PageSize

integer

The number of entries per page.

10

Extra

any

The reserved parameter.

None

Examples

Success response

JSON format

{
  "Code": "200",
  "Message": "Successful",
  "RequestId": "0A74B755-98B7-59DB-8724-1321B394****",
  "Success": "true",
  "Data": {
    "List": [
      {
        "Latancy": 10000,
        "Ext": "None",
        "ExecuteTime": "2023-05-23 T12:11:20Z",
        "OriginTime": "2023-05-23 T12:11:20.999Z",
        "HostAddress": "47.100.XX.XX",
        "UpdateRows": 30,
        "LogicRead": 12,
        "SQLText": "select 1",
        "LockTime": 1,
        "ScanRows": 29,
        "ThreadID": 657,
        "State": "0",
        "DBName": "testDB",
        "SqlType": "select",
        "AccountName": "testuser",
        "PhysicSyncRead": 0,
        "PhysicAsyncRead": 0,
        "TransactionId": "0",
        "ReturnRows": 1,
        "NodeId": "pi-bp120roy76f3qbd84"
      }
    ],
    "Total": 20,
    "PageNo": 2,
    "PageSize": 10,
    "Extra": "None"
  }
}

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.