Checking SQL Statements
After connecting a database to the database audit instance, view the database's SQL statements and details. You can also export the SQL statements to a .csv file.
Prerequisites
- The database audit instance is in the Running state.
- For details about how to enable database audit, see Enable Database Audit.
- A security group rule has been configured for the database audit instance.
Constraints and Limitations
- Up to 10,000 records can be exported at a time.
- The maximum length of an audit statement or result set is 10,240 bytes. Excessive parts are not recorded in audit logs.
Checking the SQL Statement List
- Log in to the DBSS console.
- Click
in the upper left corner on the displayed page and select a region. - In the navigation tree on the left, choose Data Reports. The Data Reports page is displayed.
- In the Instance drop-down list, select the instance whose SQL statement information you want to view.
- Click the Statements tab.
- View SQL statement information. Figure 1 Querying SQL statements
To query a specified SQL statement, perform the following steps:- Select a time range (All time, 30 minutes, 1 hour, 24 hours, 7 days, or 30 days) or customize the start time and end time. The SQL statements in the time period are displayed in the list.
- Click
and select a filter or enter a keyword.
Table 1 SQL statement parameters Parameter
Description
SQL Statements
Executed SQL statement.
Client IP Address
IP address of the client where an SQL statement is executed
Database IP Address/Domain Name
IP address or the domain name of the database where an SQL statement is executed.
Database User
Database user who executes an SQL statement.
Name
Name of the database where an SQL statement is executed.
Risk Level
Risk level of executing an SQL statement.
- High
- Medium
- Low
- No risk
Rule
Rule for executing an SQL statement.
Operation Type
Type of an SQL statement operation
Result
Response to an SQL statement.
Generated
Time when an SQL statement is generated.
Operation
Operations that can be performed on an SQL statement.
- Add to Whitelist: You can add SQL statements to the whitelist. The database audit function will ignore the whitelisted SQL statements.
Checking SQL Statement Details
- Click the SQL statement.
- View the SQL statement information in the StatementDetails dialog box. For details about related parameters, see Table 2. Figure 2 Statement dialog box
Table 2 Parameters for details of SQL statements Parameter
Description
Session ID
ID of an SQL statement, which is automatically generated
Database Instance
Database where an SQL statement is executed
Database Type
Type of the database where an SQL statement is executed
Database User
Database user for executing an SQL statement
Client MAC Address
MAC address of the client where an SQL statement is executed
Database MAC Address
MAC address of the database where an SQL statement is executed
Client IP Address
IP address of the client where an SQL statement is executed
Database IP Address/Domain Name
IP address or the domain name of the database where an SQL statement is executed
Client Port
Port of the client where an SQL statement is executed
Database Port
Port of the database where the SQL statement is executed
Client Name
Name of the client where an SQL statement is executed
Operation Type
Type of an SQL statement operation
Operation Object Type
Type of an SQL statement operation object
Response Result
Response to an SQL statement
Affected Rows
Number of rows affected by executing an SQL statement
Started
Time when an SQL statement starts to be executed
Ended
Time when the SQL statement execution ends
SQL Statement
Name of an SQL statement
Request Result
Result of requesting for executing an SQL statement
Exporting SQL Statements
- To export specified SQL statements, perform the following steps:
- Select a time range (All time, 30 minutes, 1 hour, 24 hours, 7 days, or 30 days) or customize the start time and end time. The SQL statements in the time period are displayed in the list.
- Click
and select a filter or enter a keyword.
- Click Export.
- In the displayed dialog box, click Figure 3 to export the SQL statements.
References
- If the entered SQL statement is not displayed, the connection between the agent and the database audit instance is abnormal. Rectify the fault by following the instructions in What Do I Do If the Communication Between the Agent and Database Audit Instance Is Abnormal?
- If you use an agent to audit a user-built database or a cloud database, disable SSL for the database. Otherwise, the audit will fail. For details, see How Do I Disable SSL for a Database?
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot
