Queries audit information about a database instance. The information is provided by the secure access proxy feature.

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 ListProxySQLExecAuditLog

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

StartTime Long Yes 1636876446000

The beginning of the time range to query. The value of this parameter must be a timestamp that follows the UNIX time format.

EndTime Long Yes 1636962846000

The end of the time range to query. The value of this parameter must be a timestamp that follows the UNIX time format.

SearchName String No test

The name of the database instance.

OpUserName String No testNickName

The alias of the user.

SQLType String No SELECT

The type of SQL statement. Valid values:

  • SELECT
  • INSERT
  • DELETE
  • CREATE_TABLE
Note You can choose Operation Audit > Secure Access Proxy in the top navigation bar of the DMS console to view more types of SQL statements.
ExecState String No SUCCESS

The execution status of the SQL statement. Valid values:

  • FAIL: The execution of the SQL statement fails.
  • CANCEL: The execution of the SQL statement is canceled.
  • SUCCESS: The SQL statement is executed.
PageSize Integer Yes 100

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

PageNumber Integer Yes 1

The number of the page to return.

Tid Long No 14****

The ID of the tenant. You can call the GetUserActiveTenant operation to query the tenant ID.

RegionId String No cn-hangzhou

The region in which DMS is activated. For more information, see RegionID parameter.

Response parameters

Parameter Type Example Description
TotalCount Long 1

The number of entries returned.

RequestId String 50ECB006-2C35-5FCA-91B9-01987A0B****

The ID of the request.

ErrorCode String InvalidStartTime

The error code returned.

ErrorMessage String Specified parameter StartTime is not valid.

The error message returned.

Success Boolean true

Indicates whether the request was successful. Valid values:

  • true: The request was successful.
  • false: The request failed.
ProxySQLExecAuditLogList Array of ProxySQLExecAuditLog

The audit information about the database instance that is provided by the secure access proxy feature.

ProxySQLExecAuditLog
OpTime String 1636876446000

The time at which the user executes the SQL statement on the database instance. The value of this parameter must be a timestamp that follows the UNIX time format.

UserName String testNickName

The nickname of the user.

UserId Long 4****

The ID of the user.

InstanceName String pc-uf662nrg017c6****.mysql.polardb.rds.aliyuncs.com:3306[test]

The name of the database instance.

InstanceId Long 4***

The ID of the database instance.

SchemaName String test_db

The name of the database.

SQLType String SELECT

The type of the SQL statement. Valid values:

  • SELECT
  • INSERT
  • DELETE
  • CREATE_TABLE
Note You can choose Operation Audit > Secure Access Proxy in the top navigation bar of the DMS console to view more types of SQL statements.
SQL String select 1;

The SQL statement that was executed.

ExecState String SUCCESS

The execution status of the SQL statement. Valid values:

  • FAIL: The execution of the SQL statement fails.
  • CANCEL: The execution of the SQL statement is canceled.
  • SUCCESS: The SQL statement is executed.
AffectRows Long 1

Indicates the total number of rows returned after the SQL statement was executed. If an SELECT SQL statement is executed, the return value of this parameter indicates the total number of the queried data rows.

ElapsedTime Long 1324

The amount of time that is consumed to execute the SQL statement. Unit: milliseconds.

Remark String success

The description.

Examples

Sample requests

http(s)://dms-enterprise.aliyuncs.com/?Action=ListProxySQLExecAuditLog
&StartTime=1636876446000
&EndTime=1636962846000
&SearchName=test
&OpUserName=testNickName
&SQLType=SELECT
&ExecState=SUCCESS
&PageSize=100
&PageNumber=1
&Tid=14****
&Common request parameters

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<ListProxySQLExecAuditLogResponse>
    <TotalCount>1</TotalCount>
    <RequestId>50ECB006-2C35-5FCA-91B9-01987A0B****</RequestId>
    <Success>true</Success>
    <ProxySQLExecAuditLogList>
        <OpTime>1636876446000</OpTime>
        <UserName>testNickName</UserName>
        <UserId>4****</UserId>
        <InstanceName>rm-xxx:3306</InstanceName>
        <InstanceId>4***</InstanceId>
        <SchemaName>test_db</SchemaName>
        <SQLType>SELECT</SQLType>
        <SQL>select 1;</SQL>
        <ExecState>SUCCESS</ExecState>
        <AffectRows>1</AffectRows>
        <ElapsedTime>1324</ElapsedTime>
        <Remark>success</Remark>
    </ProxySQLExecAuditLogList>
</ListProxySQLExecAuditLogResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "TotalCount" : 1,
  "RequestId" : "50ECB006-2C35-5FCA-91B9-01987A0B****",
  "Success" : true,
  "ProxySQLExecAuditLogList" : [ {
    "OpTime" : "1636876446000",
    "UserName" : "testNickName",
    "UserId" : "4****",
    "InstanceName" : "pc-uf662nrg017c6****.mysql.polardb.rds.aliyuncs.com:3306[test]",
    "InstanceId" : "4***",
    "SchemaName" : "test_db",
    "SQLType" : "SELECT",
    "SQL" : "select 1;",
    "ExecState" : "SUCCESS",
    "AffectRows" : 1,
    "ElapsedTime" : 1324,
    "Remark" : "success"
  } ]
}

Error codes

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