-
Notifications
You must be signed in to change notification settings - Fork 27
PS-10191 [DOCS] - Update Audit Log Filter installation instructions f… #573
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,133 @@ | ||
# Install the Audit Log Filter | ||
|
||
The `plugin_dir` system variable defines the plugin library location. If needed, at server startup, set the `plugin_dir` variable. | ||
## Installation script | ||
|
||
When upgrading a MySQL installation, plugins are not automatically upgraded. You may need to manually load the plugin after the MySQL upgrade. | ||
The recommended way to install the plugin is to use the `audit_log_filter_linux_install.sql` script, located in the share directory, which creates the required tables before installing the plugin. | ||
|
||
In the `share` directory, locate the `audit_log_filter_linux_install.sql `script. | ||
### Prerequisites | ||
|
||
Implemented in 8.0.34, at the time you run the script, you can select the database used to store the JSON filter tables. | ||
The `plugin_dir` system variable defines the plugin library location. When you need a custom location, set the `plugin_dir` variable at server startup. | ||
|
||
* If the plugin is loaded, the installation script takes the database name from the `audit_log_filter_database` variable | ||
* If the plugin is not loaded, but passes the `-D db_name` to the mysql client when the installation script runs, uses the `db_name`. | ||
* If the plugin is not loaded and the `-D` option is not provided, the installation script creates the required tables in the default database name `mysql`. | ||
### Database selection | ||
|
||
You can also designate a different database with the `audit_log_filter_database` system variable. The database name cannot be NULL or exceed 64 characters. If the database name is invalid, the audit log filter tables are not found. | ||
The script determines the target database using the following priority: | ||
|
||
With 8.0.34 and higher, use this command: | ||
1. When the plugin is already loaded, the script uses the database name from the `audit_log_filter_database` variable | ||
|
||
2. When the plugin is not loaded, but you pass the `-D db_name` option to the mysql client when running the script, the script uses the specified `db_name` | ||
|
||
```{.bash data-prompt="$"} | ||
$ mysql -u -D database -p < audit_log_filter_linux_install.sql | ||
3. When the plugin is not loaded and no `-D` option is provided, you must specify the `mysql` database when running the script | ||
|
||
You can also designate a different database with the `audit_log_filter_database` system variable. The database name cannot be NULL or exceed 64 characters. When the database name is invalid, the audit log filter tables are not found. | ||
|
||
### Install the component | ||
|
||
To install the plugin using the script, you must specify the `mysql` database. You can do this in two ways: | ||
|
||
Option 1: Run the script from the command line with the `-D mysql` option: | ||
|
||
```bash | ||
mysql -u root -p -D mysql < /path/to/mysql/share/audit_log_filter_linux_install.sql | ||
``` | ||
|
||
Option 2: Connect to `mysql` database and run the script interactively: | ||
|
||
```sql | ||
mysql> use mysql; | ||
mysql> source /path/to/mysql/share/audit_log_filter_linux_install.sql; | ||
``` | ||
|
||
Replace `/path/to/mysql/share/` with the actual path to your MySQL installation's share directory. | ||
|
||
### Verify installation | ||
|
||
After you run the script, verify that the required tables are created: | ||
|
||
```sql | ||
mysql> 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 PLUGIN method | ||
|
||
You can also install the plugin using the `INSTALL PLUGIN` command, but this method does not create the required tables and will cause filter operations to fail. | ||
|
||
### Verify plugin installation | ||
|
||
Check that the plugin is properly installed: | ||
|
||
```sql | ||
mysql> SHOW PLUGINS LIKE 'audit_log_filter'; | ||
``` | ||
|
||
Expected output: | ||
|
||
``` | ||
+-------------------+----------+--------------------+ | ||
| Name | Status | Type | | ||
+-------------------+----------+--------------------+ | ||
| audit_log_filter | ACTIVE | AUDIT | | ||
+-------------------+----------+--------------------+ | ||
1 row in set (0.00 sec) | ||
``` | ||
|
||
### Test filter functionality | ||
|
||
Test that the audit log filter is working correctly: | ||
|
||
```sql | ||
mysql> 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) | ||
``` | ||
|
||
To verify the plugin installation, run the following command: | ||
!!! note | ||
|
||
This error occurs when the plugin is installed without the required tables. Using the SQL script prevents this issue. | ||
|
||
```{.bash data-prompt="mysql>"} | ||
mysql> SELECT PLUGIN_NAME, PLUGIN_STATUS FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME LIKE 'audit%'; | ||
### Fix missing tables | ||
|
||
When you have already installed the audit log plugin but are missing the required tables, you can run the `audit_log_filter_linux_install.sql` script to create the audit tables in the `mysql` database: | ||
|
||
```bash | ||
mysql -u root -p -D mysql < /path/to/mysql/share/audit_log_filter_linux_install.sql | ||
``` | ||
|
||
??? example "Expected output" | ||
Or interactively: | ||
|
||
```sql | ||
mysql> use mysql; | ||
mysql> source /path/to/mysql/share/audit_log_filter_linux_install.sql; | ||
``` | ||
|
||
This operation creates the missing tables without reinstalling the plugin. | ||
|
||
## Additional information | ||
|
||
For information about upgrading the audit log filter plugin, see the upgrade documentation. | ||
|
||
## References | ||
|
||
```text | ||
+--------------------+---------------+ | ||
| PLUGIN_NAME | PLUGIN_STATUS | | ||
+--------------------+---------------+ | ||
| audit_log_filter | ACTIVE | | ||
+--------------------+---------------+ | ||
``` | ||
[Audit Log Filter Overview](audit-log-filter-overview.md) | ||
|
||
After the installation, you can use the `--audit_log_filter` option when restarting the server. To prevent the server from not running the plugin use `--audit_log_filter` with either the `FORCE` or the `FORCE_PLUS_PERMANENT` values. | ||
[Audit Log Filter Variables & Functions](audit-log-filter-variables.md) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.