mysql> show global variables like 'audit%';
+--------------------------+--------------+
| Variable_name | Value |
+--------------------------+--------------+
| audit_log_buffer_size | 1048576 |
| audit_log_file | audit.log |
| audit_log_flush | OFF |
| audit_log_format | NEW |
| audit_log_policy | ALL |
| audit_log_rotate_on_size | 0 |
| audit_log_rotations | 0 |
| audit_log_strategy | ASYNCHRONOUS |
+--------------------------+--------------+
8 rows in set (0.00 sec)
它先会把日志写入内存,然后再刷入磁盘里。
audit_log_strategy参数可以调整下面4个策略
1、ASYNCHRONOUS log using memory buffer, do not drop events if buffer is full
2、PERFORMANCE log using memory buffer, drop events if buffer is full
3、SEMISYNCHRONOUS log directly to file, do not fsync every event
4、SYNCHRONOUS log directly to file, fsync every event