Percona5.6 provides the audit log function for the first time. if one day a record is lost in the database, developers will ask you to check who was taken from which IP address and perform the delete operation, therefore, it cannot be found in the previous version, and Percona's latest version 5.6.17 provides the audit log function for the first time.
(Note: As of January 1, May 19, 2014, the official MySQL5.6.17 and MariaDB10.0.11 did not provide this function)
Version:
5.6.17-65.0-rel65.0-log Percona Server with XtraDB (GPL), Release rel65.0, Revision 587
Install plug-ins:
INSTALL PLUGIN audit_log SONAME 'audit_log.so';
Show plugins; you will find
| audit_log | ACTIVE | AUDIT| audit_log.so | GPL |
Variable parameters:
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)
It will first write logs into the memory and then fl them into the disk.
The following four policies can be adjusted for the audit_log_strategy parameter:
1、ASYNCHRONOUS log using memory buffer, do not drop events if buffer is full2、PERFORMANCE log using memory buffer, drop events if buffer is full3、SEMISYNCHRONOUS log directly to file, do not fsync every event4、SYNCHRONOUS log directly to file, fsync every event
Use the default value here.
The audit_log_rotate_on_size parameter indicates that the defined value is exceeded and the log is automatically rotated and split.
The audit_log_rotations parameter specifies the number of files.
Effect:
References: http://www.mysqlperformanceblog.com/2014/05/16/introduction-to-the-percona-mysql-audit-log-plugin/