You can call this operation to query the SQL audit files of an AnalyticDB for MySQL cluster.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes DescribeAuditLogRecords

The operation that you want to perform. Set the value to DescribeAuditLogRecords.

DBClusterId String Yes am-bp1xxxxxxxx47

The ID of the cluster.

EndTime String Yes 2019-03-21T02:18:02Z

The end time of the query, which must be later than the start time of the query. Specify the time in the yyyy-MM-ddTHH:mm:ssZ format. The time must be in UTC.

RegionId String Yes cn-hangzhou

The region ID of the cluster. You can call the DescribeRegions operation to query the most recent region list.

StartTime String Yes 2019-03-20T02:18:02Z

The start time of the query. Specify the time in the yyyy-MM-ddTHH:mm:ssZ format. The time must be in UTC.

DBName String No adb_demo

The name of the database on which you want to execute the SQL statement.

QueryKeyword String No adb

The keyword for the query.

SqlType String No SELECT

The type of the SQL statement. Valid values:

  • DELETE
  • DROP
  • SELECT
  • INSERT
  • UPDATE
  • ALTER
  • INSERT_INTO_SELECT
Succeed String No true

Specifies whether the SQL statement is successful. Valid values:

  • true
  • false
HostAddress String No 127.0.**. **

The IP address of the client that executes the SQL statement.

OrderType String No asc

The order type. Valid values:

  • asc: The logs are sorted by time in ascending order.
  • desc: The logs are sorted by time in descending order.
User String No testa

The name of the user that executes the SQL statement.

PageSize Integer No 30

The number of entries to return on each page. Valid values:

  • 30
  • 50
  • 100

Default value: 30.

PageNumber Integer No 1

The number of the page to return. Valid values: 1 to 2147483647. Default value: 1.

Response parameters

Parameter Type Example Description
DBClusterId String am-bp1xxxxxxxx47

The ID of the cluster.

Items Array of SlowLogRecord

The list of SQL audit logs.

ConnId String 21435564xxxxxxxx

The connection ID.

DBName String adb_demo

The name of the database on which the SQL statement is executed.

ExecuteTime String 1

The execution time of the SQL statement. Unit: milliseconds.

HostAddress String 127.0.**. **

The IP address of the client that executes the SQL statement.

ProcessID String 201907241445301720211111570315107****

The ID of the task.

SQLText String select id,name from adb_table

The details of the SQL statement.

SQLType String SELECT

The type of the SQL statement. Valid values:

  • DELETE
  • DROP
  • SELECT
  • INSERT
  • UPDATE
  • ALTER
  • INSERT_INTO_SELECT
Succeed String true

Indicates whether the SQL statement is successful. Valid values:

  • true
  • false
TotalTime String 20

The total time consumed.

PageNumber String 10

The page number of the returned page.

PageSize String 30

The number of entries return on each page.

RequestId String 1AD222E9-E606-4A42-BF6D-8A4442913CEF

The ID of the request.

TotalCount String 300

The total number of entries.

Examples

Sample requests

http(s)://[Endpoint]/? Action=DescribeAuditLogRecords
&DBClusterId=am-bp1xxxxxxxx47
&EndTime=2019-03-20T05:18:02Z
&RegionId=cn-hangzhou
&StartTime=2019-03-20T02:18:02Z
&<Common request parameters>

Sample success responses

XML format

<TotalCount>300</TotalCount>
<PageSize>30</PageSize>
<RequestId>1AD222E9-E606-4A42-BF6D-8A4442913CEF</RequestId>
<PageNumber>10</PageNumber>
<DBClusterId>am-bp1xxxxxxxx47</DBClusterId>
<Items>
    <ConnId>21435564xxxxxxxx</ConnId>
    <ExecuteTime>1</ExecuteTime>
    <TotalTime>20</TotalTime>
    <DBName>adb_demo</DBName>
    <ProcessID>201907241445301720211111570315107****</ProcessID>
    <SQLType>SELECT</SQLType>
    <HostAddress>127.0. **. **</HostAddress>
    <Succeed>true</Succeed>
    <SQLText>select id,name from adb_table</SQLText>
</Items>

JSON format

{
    "TotalCount": 300,
    "PageSize": 30,
    "RequestId": "1AD222E9-E606-4A42-BF6D-8A4442913CEF",
    "PageNumber": 10,
    "DBClusterId": "am-bp1xxxxxxxx47",
    "Items": {
        "ConnId": "21435564xxxxxxxx",
        "ExecuteTime": 1,
        "TotalTime": 20,
        "DBName": "adb_demo",
        "ProcessID": "201907241445301720211111570315107****",
        "SQLType": "SELECT",
        "HostAddress": "127.0. **. **",
        "Succeed": true,
        "SQLText": "select id,name from adb_table"
    }
}

Error codes

HttpCode Error code Error message Description
404 InvalidDBCluster.NotFound The DBClusterId provided does not exist in our records. The error message returned because the specified cluster ID does not exist. Check whether you specify the cluster ID value correctly.

For a list of error codes, visit the API Error Center.