All Products
Search
Document Center

Database Autonomy Service:GetDasSQLLogHotData

最終更新日:Dec 23, 2024

Queries the hot data of audit logs.

Operation description

Before you call this operation, take note of the following items:

  • If you use an Alibaba Cloud SDK or DAS SDK to call this operation, we recommend that you use the latest version of the SDK.
  • If you use an SDK to call API operations of DAS, you must set the region ID to cn-shanghai.
  • This operation is applicable to PolarDB for MySQL, ApsaraDB RDS for MySQL, ApsaraDB RDS for PostgreSQL, and ApsaraDB RDS for SQL Server.
Note The beginning of the time range to query can be up to seven days earlier than the current time. The interval between the start time and the end time cannot exceed one day. This operation can return a maximum of 10,000 entries.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
hdm:GetDasSQLLogHotDataget
*All Resources
*
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
InstanceIdstringYes

The ID of the database instance.

rm-2ze1jdv45i7l6****
StartlongYes

The beginning of the time range to query. Specify a UNIX timestamp representing the number of milliseconds that have elapsed since January 1, 1970, 00:00:00 UTC.

Note The beginning of the time range to query must be later than the time when DAS Enterprise Edition is enabled, and can be up to seven days earlier than the current time.
1684734297000
EndlongYes

The end of the time range to query. Set this parameter to a UNIX timestamp representing the number of milliseconds that have elapsed since January 1, 1970, 00:00:00 UTC.

Note The end time must be later than the start time. The interval between the start time and the end time cannot exceed 24 hours.
1684820697000
QueryKeywordstringNo

The keyword that is used for the query.

Note Fuzzy search is not supported. You can query data by using multiple keywords. Separate keywords with spaces.
test
AccountNamestringNo

The account of the database.

Note You can specify multiple database accounts that are separated by spaces. Example: user1 user2 user3.
testuser
DBNamestringNo

The name of the database.

Note You can specify multiple database names that are separated by spaces. Example: DB1 DB2 DB3.
testDB
HostAddressstringNo

The IP address of the client.

Note You can specify multiple IP addresses that are separated by spaces. Example: IP1 IP2 IP3.
47.100.XX.XX
LogicalOperatorstringNo

The logical relationship among multiple keywords.

  • or
  • and
or
MaxLatancylongNo

The maximum execution duration. Unit: microseconds. You can specify this parameter to query the SQL statements whose execution duration is smaller than the value of this parameter.

100
MaxScanRowslongNo

The maximum number of scanned rows. You can specify this parameter to query the SQL statements that scan a smaller number of rows than the value of this parameter.

10000
MinLatancylongNo

The minimum execution duration. Unit: microseconds. You can specify this parameter to query the SQL statements whose execution duration is greater than or equal to the value of this parameter.

10
MinScanRowslongNo

The minimum number of scanned rows. You can specify this parameter to query the SQL statements that scan a larger or an equal number of rows than the value of this parameter.

10
SqlTypestringNo

The type of the SQL statement. Valid values:

  • SELECT
  • UPDATE
  • DELETE
SELECT
StatestringNo

The execution results. You can specify 0 to query the SQL statements that are successfully executed. You can also specify an error code to query the corresponding SQL statements that fail to be executed.

0
ThreadIDstringNo

The thread ID.

Note You can specify multiple thread IDs that are separated by spaces. Example: Thread ID1 Thread ID2 Thread ID3.
657
PageNumberslongNo

The page number. Pages start from page 1. Default value: 1.

2
MaxRecordsPerPagelongNo

The maximum number of entries per page. Valid values: 5 to 100.

10
SortKeystringNo

The basis on which you want to sort the query results.

  • SCAN_ROWS: the number of scanned rows.
  • UPDATE_ROWS: the number of updated rows.
  • CONSUME: the time consumed.
  • ORIGIN_TIME: the execution duration.
SCAN_ROWS
SortMethodstringNo

The order in which you want to sort the query results.

  • ase: ascending order.
  • desc: descending order.
ase
ChildDBInstanceIDsstringNo

The node ID.

Note This parameter must be specified if the database instance is a PolarDB for MySQL cluster.
pi-bp179lg03445l****
RolestringNo

The reserved parameter. This parameter is not supported.

None
TraceIdstringNo

The reserved parameter. This parameter is not supported.

None
MinRowslongNo

The reserved parameter. This parameter is not supported.

None
MaxRowslongNo

The reserved parameter. This parameter is not supported.

None
MinSpillCntlongNo

The reserved parameter. This parameter is not supported.

None
MaxSpillCntlongNo

The reserved parameter. This parameter is not supported.

None
TransactionIdstringNo

The transaction ID.

0
FailstringNo

The error code of SQL execution. You can call the GetAsyncErrorRequestStatByCode operation to query MySQL error codes in SQL Explorer data.

1064

Response parameters

ParameterTypeDescriptionExample
object
Codestring

The HTTP status code returned.

200
Messagestring

The returned message.

Note If the request was successful, Successful is returned. If the request failed, an error message such as an error code is returned.
Successful
RequestIdstring

The request ID.

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

Indicates whether the request was successful. Valid values:

  • true
  • false
true
Dataobject

The data returned.

Listarray<object>

The details of the data returned.

Listobject
Latancylong

The execution duration. Unit: microseconds.

10000
Extstring

The extended information. This parameter is a reserved parameter.

None
ExecuteTimestring

The execution time. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.

2023-05-23 T12:11:20Z
OriginTimestring

The execution time. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.

2023-05-23 T12:11:20.999Z
HostAddressstring

The IP address of the client.

47.100.XX.XX
UpdateRowslong

The number of updated rows.

30
LogicReadlong

The number of logical reads.

12
SQLTextstring

The content of the SQL statement.

select 1
LockTimelong

The lock wait duration. Unit: microseconds.

1
ScanRowslong

The number of rows scanned by the SQL statement.

29
ThreadIDlong

The thread ID.

657
Statestring

The execution result. If a 0 is returned, the SQL statement was successfully executed. If an error code is returned, the SQL statement failed to be executed.

0
DBNamestring

The name of the database.

testDB
SqlTypestring

The type of the SQL statement. Valid values:

  • SELECT
  • UPDATE
  • DELETE
SELECT
AccountNamestring

The account of the database.

testuser
PhysicSyncReadlong

The number of physical synchronous reads.

0
PhysicAsyncReadlong

The number of physical asynchronous reads.

0
TransactionIdstring

The transaction ID.

0
ReturnRowslong

The number of rows returned.

1
Totallong

The total number of entries returned.

20
PageNolong

The page number.

2
PageSizelong

The number of entries per page.

10
Extraany

The reserved parameter.

None

Examples

Sample success responses

JSONformat

{
  "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
      }
    ],
    "Total": 20,
    "PageNo": 2,
    "PageSize": 10,
    "Extra": "None"
  }
}

Error codes

HTTP status codeError codeError message
400InvalidParamsThe request parameters are invalid.
403NoPermissionYou are not authorized to do this action.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2024-06-04The Error code has changedView Change Details