Query the SQL audit logs generated for an instance.

Request parameters

Name Type Required? Description
Action String Yes Required parameter. Value: DescribeSQLLogRecords.
DBInstanceId String Yes Instance ID.
Database String No Default value: All.
User String No Default value: All.
Form String No File: trigger of audit log file generation. If this parameter is set to File, only public parameters are returned, and you must call DescribeSQLLogFilesinterface to obtain the final download file address; if this parameter is set to Stream, data streams are returned. Default value: Stream.
QueryKeywords String No Keywords used for query, which are separated by spaces. Up to 10 keywords can be entered.
StartTime String Yes Query start time. Format: yyyy-MM-dd’T’HH:mm:ssZ.
EndTime String Yes Query end time, which must be later than the query start time. Format:yyyy-MM-dd’T’HH:mm:ssZ.
PageSize Integer No Number of records on every page. Values: 30, 50, and 100; default value: 30.
PageNumber Integer No Page number, which must be greater than 0, but must not exceed the maximum Integer value. Default value: 1.

Return parameters

Name Type Description
<Public Return Parameters> For more information, see Public parameters.
TotalRecordCount Integer Total number of records.
PageNumber Integer Page number.
PageRecordCount Integer Number of SQL logs displayed on the current page.

SQLRecord parameters

Name Type Description
DBName String Name of a database.
AccountName String Name of an account.
HostAddress String Client IP address.
SQLText String SQL statement.
TotalExecutionTimes Long Time consumed, in the unit of microseconds.
ReturnRowCounts Long Number of returned records.
ThreadID String Thread ID.
ExecuteTime String Execution time. Format: yyyy-MM-dd’T’HH:mm:ss Z, for example, 2011-05-30 T12:11:20Z.

Request example
&<Public Request Parameters>

Response example

XML format

  <PageRecordCount >1<PageRecordCount>
    <SQLText>update test.zxb set id=0 limit 1</SQLText>
    <TotalExecutionTimes >12</TotalExecutionTimes>

JSON format

"SQLText":”update test.zxb set id=0 limit 1”
"RequestId": "08A3B71B-FE08-4B03-974F-CC7EA6DB1828"