percona mysql5.7关闭审计功能方法

数据库的审计日志占用大量空间,当时是为了测试审计功能开启的,现在需要关闭


# /data/mysql_data]# du -sh *
124G    audit.log


# 查询审计相关参数
mysql> show variables like '%audit%';
+-----------------------------+---------------+
| Variable_name               | Value         |
+-----------------------------+---------------+
| audit_log_buffer_size       | 1048576       |
| audit_log_exclude_accounts  |               |
| audit_log_exclude_commands  |               |
| audit_log_exclude_databases |               |
| audit_log_file              | audit.log     |
| audit_log_flush             | OFF           |
| audit_log_format            | OLD           |
| audit_log_handler           | FILE          |
| audit_log_include_accounts  |               |
| audit_log_include_commands  |               |
| audit_log_include_databases |               |
| audit_log_policy            | QUERIES       |
| audit_log_rotate_on_size    | 0             |
| audit_log_rotations         | 0             |
| audit_log_strategy          | ASYNCHRONOUS  |
| audit_log_syslog_facility   | LOG_USER      |
| audit_log_syslog_ident      | percona-audit |
| audit_log_syslog_priority   | LOG_INFO      |
+-----------------------------+---------------+
18 rows in set (0.00 sec)

mysql> show variables like 'plugin_dir';
+---------------+----------------------------------------------------+
| Variable_name | Value                                              |
+---------------+----------------------------------------------------+
| plugin_dir    | /usr/local/percona-server-5.7.14/lib/mysql/plugin/ |
+---------------+----------------------------------------------------+
1 row in set (0.00 sec)


# 查看插件
# ls /usr/local/percona-server-5.7.14/lib/mysql/plugin/
adt_null.so          daemon_example.ini  keyring_udf.so        libmurmur_udf.so              libtest_session_info.so       libtest_sql_commit.so       libtest_sql_replication.so                  libtest_x_sessions_deinit.so  mysqlx.so               replication_observers_example_plugin.so  semisync_slave.so
audit_log.so         debug               libdaemon_example.so  libtest_framework.so          libtest_session_in_thd.so     libtest_sql_complex.so      libtest_sql_shutdown.so                     libtest_x_sessions_init.so    qa_auth_client.so       rewrite_example.so                       test_security_context.so
auth.so              ha_example.so       libfnv1a_udf.so       libtest_services.so           libtest_sql_2_sessions.so     libtest_sql_errors.so       libtest_sql_sqlmode.so                      locking_service.so            qa_auth_interface.so    rewriter.so                              test_udf_services.so
auth_socket.so       innodb_engine.so    libfnv_udf.so         libtest_services_threaded.so  libtest_sql_all_col_types.so  libtest_sql_lock.so         libtest_sql_stored_procedures_functions.so  mypluglib.so                  qa_auth_server.so       scalability_metrics.so                   validate_password.so
auth_test_plugin.so  keyring_file.so     libmemcached.so       libtest_session_detach.so     libtest_sql_cmds_1.so         libtest_sql_processlist.so  libtest_sql_views_triggers.so               mysql_no_login.so             query_response_time.so  semisync_master.so                       version_token.so


关闭方法:
# https://www.percona.com/blog/2015/09/10/percona-server-audit-log-plugin-best-practices/
变量audit_log_policy可以设置为NONE以停止系统上的日志记录。如果这是永久性更改,请将该值添加到my.cnf文件中。 

# 使用下面这条命令,就可以关闭审计日志功能
set global audit_log_policy=none; 

 

posted @ 2018-08-04 10:38  reblue520  阅读(616)  评论(0编辑  收藏  举报