All Products
Search
Document Center

Database Autonomy Service:GetDasSQLLogHotData

Last Updated:Mar 12, 2026

Retrieves hot data from audit logs.

Operation description

Before you use this API, ensure that the following requirements are met:

  • You are using the latest version of the Alibaba Cloud or DAS SDK.

  • When calling the DAS service with an SDK, set the region to cn-shanghai.

  • The database engine is one of the following: PolarDB MySQL, RDS MySQL, RDS PostgreSQL, or RDS 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 start and end times must not exceed 1 day. This API returns up to 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 ID of the database instance.

rm-2ze1jdv45i7l6****

Start

integer

Yes

Query start time in UNIX timestamp format, in milliseconds.

Note

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

1684734297000

End

integer

Yes

Query end time in UNIX timestamp format, in milliseconds.

Note

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

1684820697000

QueryKeyword

string

No

Keywords.

Note

Fuzzy queries are supported. You can combine up to 10 keywords, separated by spaces. Example: a1 b2 c3.

a1 b2

AccountName

string

No

Database account.

Note

Supports combining multiple database accounts for queries, with accounts separated by spaces. Example: user1 user2 user3.

testuser

DBName

string

No

Database name.

Note

Supports combining multiple database names for queries, with names separated by spaces. Example: DB1 DB2 DB3.

testDB

HostAddress

string

No

Client IP address.

Note

Supports combining multiple client IP addresses for queries, with addresses separated by spaces. Example: IP1 IP2 IP3.

47.100.XX.XX

LogicalOperator

string

No

Logical relationship between multiple keywords.

  • or: OR.

  • and: AND.

or

MaxLatancy

integer

No

Maximum execution duration in microseconds. Queries SQL statements with execution durations less than this value.

100

MaxScanRows

integer

No

Maximum number of scanned rows. Queries SQL statements with scanned rows less than this value.

10000

MinLatancy

integer

No

Minimum execution duration in microseconds. Queries SQL statements with execution durations greater than or equal to this value.

10

MinScanRows

integer

No

Minimum number of scanned rows. Queries SQL statements with scanned rows greater than or equal to this value.

10

SqlType

string

No

SQL statement type. Valid values:

  • select

  • update

  • delete

Valid values:

  • select :

    Query

  • update :

    Update

  • delete :

    Delete

select

State

string

No

Execution result. Enter 0 to query successfully executed SQL statements. You can also enter a specific error code to query corresponding SQL statements.

0

ThreadID

string

No

Thread ID.

Note

Supports combining multiple thread IDs for queries, with IDs separated by spaces. Example: Thread ID1 Thread ID2 Thread ID3.

657

PageNumbers

integer

No

Page number for paged query, starting from 1. Default value: 1.

2

MaxRecordsPerPage

integer

No

Maximum number of records per page for paged query. Valid values: 5 to 100.

10

SortKey

string

No

Sorting basis.

  • ScanRows: Number of scanned rows.

  • UpdateRows: Number of updated rows.

  • Consume: Execution duration.

  • OriginTime: Execution time.

  • ReturnRows: Number of returned rows.

ScanRows

SortMethod

string

No

Sorting method.

  • ASC: Ascending order.

  • DESC: Descending order.

ASC

ChildDBInstanceIDs

string

No

Node ID.

Note

Required for PolarDB MySQL instances.

pi-bp179lg03445l****

Role

string

No

Reserved parameter. Not currently supported.

None

TraceId

string

No

Reserved parameter. Not currently supported.

None

MinRows

integer

No

Reserved parameter. Not currently supported.

None

MaxRows

integer

No

Reserved parameter. Not currently supported.

None

MinSpillCnt

integer

No

Reserved parameter. Not currently supported.

None

MaxSpillCnt

integer

No

Reserved parameter. Not currently supported.

None

TransactionId

string

No

Transaction ID.

0

Fail

string

No

SQL execution error code. Call GetAsyncErrorRequestStatByCode to get error codes.

1064

Response elements

Element

Type

Description

Example

object

Code

string

The status code.

200

Message

string

The response message.

Note

If the request succeeds, this parameter returns Successful. If the request fails, it returns exception information such as an error code.

Successful

RequestId

string

The unique request ID generated by Alibaba Cloud.

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

Success

string

Indicates whether the request succeeded:

  • true: The request succeeded.

  • false: The request failed.

true

Data

object

The returned data.

List

array<object>

The list of returned information.

object

The returned SQL insight and audit data.

Latancy

integer

Execution duration in microseconds.

10000

Ext

string

Extended information field. Reserved parameter.

None

ExecuteTime

string

Execution time in UTC format: yyyy-MM-ddTHH:mm:ssZ.

2023-05-23 T12:11:20Z

OriginTime

string

Execution time in UTC format: yyyy-MM-ddTHH:mm:ss.SSSZ.

2023-05-23 T12:11:20.999Z

HostAddress

string

Client IP address.

47.100.XX.XX

UpdateRows

integer

Number of updated rows.

30

LogicRead

integer

Logical reads.

12

SQLText

string

SQL statement details.

select 1

LockTime

integer

Lock wait time in microseconds.

1

ScanRows

integer

Number of scanned rows.

29

ThreadID

integer

Thread ID.

657

State

string

Status. Returns 0 for successful execution. Otherwise, returns an error code.

0

DBName

string

Database name.

testDB

SqlType

string

SQL type. Valid values:

  • select

  • update

  • delete

select

AccountName

string

Database account.

testuser

PhysicSyncRead

integer

Physical synchronous read.

0

PhysicAsyncRead

integer

Physical asynchronous read.

0

TransactionId

string

Initiated transaction ID.

0

ReturnRows

integer

Number of returned rows.

1

NodeId

string

Total

integer

Total number of returned records.

20

PageNo

integer

Page number.

2

PageSize

integer

Number of entries per page.

10

Extra

any

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": ""
      }
    ],
    "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.
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.