Install the audit log filter¶
Installation script¶
Run audit_log_filter_linux_install.sql from the server share directory. The script creates the audit tables, then installs the component.
Prerequisites¶
plugin_dir locates the component library; set it at startup if the default path is wrong.
Database selection¶
The script picks the target database in this order:
-
If the component is already loaded, the script uses the database name from the
audit_log_filter.databasevariable -
If the component is not loaded, but you pass the
-D db_nameoption to the mysql client when running the script, the script uses the specifieddb_name -
If the component is not loaded and no
-Doption is provided, you must specify themysqldatabase when running the script
You can also point the component at another database with audit_log_filter.database. The name must be non-NULL, at most 64 characters, and valid—otherwise the server cannot open the audit log filter tables.
Install the component¶
The script must run against the mysql database. Use either approach:
-
Option 1: Run the script from the command line with the
-D mysqloption:mysql -u root -p -D mysql < /path/to/mysql/share/audit_log_filter_linux_install.sql -
Option 2: Connect to
mysqldatabase and run the script interactively:use mysql; source /path/to/mysql/share/audit_log_filter_linux_install.sql;Replace
/path/to/mysql/share/with the actual path to your server installation’ssharedirectory.
Verify installation¶
Confirm the audit tables exist:
show tables in mysql like 'aud%';
Expected output
+------------------------+
| Tables_in_mysql (aud%) |
+------------------------+
| audit_log_filter |
| audit_log_user |
+------------------------+
2 rows in set (0.00 sec)
Alternative: INSTALL COMPONENT method¶
INSTALL COMPONENT loads the binary only—it does not create tables, so filter UDFs fail until you run the install script.
INSTALL COMPONENT 'file://audit_log_filter';
Verify component installation¶
Confirm the component row exists:
select * from mysql.component;
Expected output
+--------------+--------------------+------------------------------------+
| component_id | component_group_id | component_urn |
+--------------+--------------------+------------------------------------+
| 1 | 1 | file://component_percona_telemetry |
| 2 | 2 | file://component_audit_log_filter |
+--------------+--------------------+------------------------------------+
2 rows in set (0.00 sec)
Test filter functionality¶
Exercise a filter UDF:
SELECT audit_log_filter_set_filter('log_all', '{"filter": {"log": true}}');
Expected output
+---------------------------------------------------------------------+
| audit_log_filter_set_filter('log_all', '{"filter": {"log": true}}') |
+---------------------------------------------------------------------+
| ERROR: Failed to check filtering rule name existence |
+---------------------------------------------------------------------+
1 row in set (0.00 sec)
Note
This error appears when the component loads without the tables. Run audit_log_filter_linux_install.sql first.
Fix missing tables¶
If the component is installed but tables are missing, run the install script against mysql:
mysql -u root -p -D mysql < /path/to/mysql/share/audit_log_filter_linux_install.sql
Or interactively:
use mysql;
source /path/to/mysql/share/audit_log_filter_linux_install.sql;
The script adds the tables and does not reinstall the component.
Additional information¶
If you are replacing an existing audit plugin (the legacy audit_log plugin or the transitional audit_log_filter plugin) with the component, see Migrate to the audit log filter component for the variable mapping, policy translation, and a worked example. The general plugin-to-component framing is in Upgrade from plugins to components.
Additional reading¶
- Audit Log Filter overview
- Audit Log Filter quickstart
- Audit log filter functions, options, and variables
- Uninstall Audit Log Filter
- Upgrade components
- Upgrade Percona Server for MySQL
Review Get help from Percona for ways that we can work with you.