Show TOC

SQL Audit 

Description

The SQL Audit logs all OPEN SQL SELECT statements to certain tables in dialog work processes. It writes the statements in sequential files in the file system on the application server. It uses one file per dialog work process. It closes the file and opens a new one at midnight on each day. It also creates a new file if the file reaches the maximum size.

Note that only OPEN SQL SELECT statements are logged. Neither write statements such as INSERT, UPDATE, or DELETE nor other database access statements such as EXEC SQL are recorded.

Software/hardware requirements

The SQL Audit requires a large amount of disk space and CPU time. You can expect a decrease in performance if you activate the SQL Audit.

Installation information

To use the SQL Audit you need to:

1. Define the number range for the SQL Audit files.
The SQL Audit uses a sequential number range for the naming of the audit files. Define this number range with the Transaction SNRO and modify the Number ranges for the object SEC_AUDIT. Make sure you define the number range in client 000!
2. Define the tables for which you want to log SQL statements.
Each table has a flag which indicates whether or not read requests should be logged. Use the program RSAU_SQL_SHOW_NAMETAB to display this flag for tables and RSQU_SQL_UPDATE_NAMETAB to change it. This setting takes place immediately; there is no need to reboot. This program only affects active tables. If you create a new table for which you want logging to take place, then you have to run this program and activate the flag for the new table.
3. Set profile parameters.
You have to set the following profile parameters (either in all instances or in the default profile).
Set this parameter to 'on' to activate the SQL Audit and log the SQL SELECT statements. The default is ' off' meaning that no statements are logged.
Use this parameter to specify a pattern for filenames. Within this pattern, you must include a series of eight '+ ' characters as a placeholder for an eight digit sequence number. The default setting is 'SQL_++++++++.AUD '.
Use this parameter to specify the directory where the files should be located. The default directory is specified in the parameter DIR_LOGGING. For performance reasons, we recommend using a local directory on the application server. For best results, use a separate disk that is used for the SQL Audit only.
With this parameter, you specify the maximum file size. If this size is reached, the SQL Audit closes the file and creates a new one. You can either specify the file size in bytes (no suffix), kilobytes (suffix = 'k' or 'K '), or megabytes (suffix = 'm' or 'M '). The default value is 645 megabytes. In extreme cases the SQL Audit file may exceed the value specified by this parameter.

Example

rsau/SQL-Audit/switch = on
rsau/SQL-Audit/filename = SQL_++++++++.AUD
rsau/SQL-Audit/logdir = D:\SQL-Audit
rsau/SQL-Audit/filesize = 100m

System administration changes

If you activate the SQL Audit, then your system administrator must manually archive and delete the SQL Audit files. We recommend archiving and deleting the files on a regular basis to avoid an overflow of the file system.

Planning

The following improvements are planned for the SQL Audit:

(Currently we do not provide any analysis tools for the SQL Audit.)

Further notes

For more information on installing the SQL Audit, refer to the installation guide located on the sapserv servers (for example, sapserv3):

sapserv3:~ftp/general/misc/security/sqlprot/install.doc