The SQL audit feature is designed to help you quickly identify SQL statements that may have potential issues, and enhance security audit capability. This feature supports querying SQL statements by user, IP address, or operation type, and also supports exporting query results. This topic introduces the specific operation steps for you.
Considerations
SQL audit is a paid feature. The fees vary by cloud vendor, region, and billing item. For details, see SQL audit billing.
Enable SQL audit
Log in to the OceanBase Cloud console.
In the left-side navigation pane, click Instances.
In the instance list, find the target instance, click the instance name, and go to the Overview page of the instance.
In the left-side navigation pane, click Diagnostics, and then select the Real-Time Diagnostics tab on the Diagnostics page.
In the lower part of the page, click the SQL Audit tab.
Select a tenant in the middle part of the page.
On the SQL Audit tab, click Enable SQL Audit.
Configure the related parameters in the pop-up window, and then click Enable.
Note
SQL execution records can be stored for 7 to 720 days. Records exceeding the set time will be deleted.
View and download SQL audit records
On the SQL Audit tab, click Expand.
Filter the SQL audit records by filter items, which are optional.
Filter item Description Database Select one or more databases in the tenant to view. Node Select one or more nodes to view. Keyword Enter the keywords that may exist in the SQL statements to view. You can enter multiple keywords, and the keywords are connected by AND or OR. Username Enter the name of one or more tenants to view. Operation Type Select one or more operation types to view. Client IP Enter the IP address of the client to view. Scanned Records Enter the number of scanned records to view. Execution Duration (ms) Enter the execution time range of the SQL statements. Time Range Select the time range in which the SQL statements are executed. The time range cannot exceed 6 hours. View the following information in the query results: SQL Statement, Database, User, Client IP, Operation Type, Execution Result, Request Time, Execution Duration (ms), Scanned Rows, and Updated Rows.
Click the download icon on the right side to download the query results.
Note
Currently, a maximum of 100 audit records can be downloaded. If the number of audit records exceeds 100, only the first 100 records will be downloaded in the order of page sorting.
Modify SQL audit settings
On the SQL Audit tab, click Service Settings.
Modify the related parameter settings in the pop-up window and click OK.
Notice
- SQL execution records can be stored for 7 to 720 days. Records that exceed the specified period will be deleted.
- Within the total storage period, after the records exceed the specified hot storage period, they will automatically be converted to cold storage.
Disable SQL audit
On the SQL Audit tab, click Disable Service.
Enter close in the text box of the pop-up window and click Close.