Search code examples
mysqlspaceaudit-logging

How can I turn off mysql audit log while server is running?


I do have a highly active server and can't restart it. Long back I have activated the audit log but due to space issue I need to turn it off. Below are my variables;

audit_log_buffer_size       | 1048576      |
audit_log_connection_policy | ALL          |
audit_log_current_session   | ON           |
audit_log_exclude_accounts  |              |
audit_log_file              | audit.log    |
audit_log_flush             | OFF          |
audit_log_format            | OLD          |
audit_log_include_accounts  |              |
audit_log_policy            | ALL          |
audit_log_rotate_on_size    | 0            |
audit_log_statement_policy  | ALL          |
audit_log_strategy          | ASYNCHRONOUS |

And here is my.cnf

plugin-load=audit_log.so
.
.
.
# Audit Log - 
#--------------------------
#audit-log=FORCE_PLUS_PERMANENT
#audit_log_exclude_accounts=.....
#audit_log_file= /var/log/mysql/mysql_audit_db1.log
.
.
.

Solution: After running UNINSTALL PLUGIN audit_log; it stopped logging to audit_log file for me. To verify that you can use SHOW PLUGINS;

mysql> UNINSTALL PLUGIN audit_log; 
Query OK, 0 rows affected, 1 warning (0.00 sec) 
mysql> show warnings; 
Warning | 1620 | Plugin is busy and will be uninstalled on shutdown enter code here

Solution

  • As FORCE_PLUS_PERMANENT looks commented out, you might use the UNINSTALL PLUGIN command, as written here:

    https://dev.mysql.com/doc/refman/5.5/en/server-plugin-loading.html#server-plugin-uninstalling

    If the FORCE_PLUS_PERMANENT is active, you're out of luck, as this is to protect the audit log from on-the-fly disabling.