At Percona Managed Services, we manage Percona MySQL, Community MySQL, and MariaDB. Sometimes, we might need to enable audit logging and share the logs for client MySQL Community 8.0.x servers.

There are several ways to enable audit logs. One is to use the MySQL Enterprise audit logging plugin (audit_log.so), but it only supports the MySQL Enterprise version, which requires a license and is not open source.

At Percona, we prefer open source alternatives. That’s why we developed the Percona audit logging plugin, which provides monitoring and logging of connection and query activity that was performed on a specific server. The plugin supports the following log formats: XML, JSON, and CSV. This plugin is available by default if you are using the free and open source Percona Distribution for MySQL. 

In this blog, we’ll show you how to install the Percona audit logging plugin on MySQL Community 8.0.x.

1. Install MySQL Community server 8.0.x

If you need to know how to install a specific version of MySQL 8 server on Debian, etc. Please check this link:

How to Install or Upgrade Percona Server for MySQL/MySQL 8 to a Specific Version on Debian/Ubuntu

In our case, we installed the MySQL Community server 8.0.36 on Debian 12.

2. Get the Percona audit logging plugin from binary tarball

You can get the Percona audit logging plugin from the tarball file: 

https://docs.percona.com/percona-server/8.0/binary-tarball-install.html .

For the tarball naming convention, please check this document link:

https://docs.percona.com/percona-server/8.0/binary-tarball-names.html

In our test, we need to download Percona-Server-8.0.36-28-Linux.x86_64.glibc2.35.tar.gz, and get the audit logging plugin.

The Percona audit logging plugin audit_log.so file is here in the tarball:

Percona-Server-8.0.36-28-Linux.x86_64.glibc2.35/lib/plugin/audit_log.so

We can just extract this audit_log.so file as below:

 3. Current plugin settings

We do not have audit_log.so file, for now, and we need to:

4. Copy the Percona audit logging plugin file audit_log.so to the plugin directory and install the plugin

5. Add audit parameter and restart the database service to take effect

We can see the audit log has been populated.

For details, please refer to the docs:

https://docs.percona.com/percona-server/8.0/audit-log-plugin.html#audit_log_syslog_ident

Conclusion

I hope this is helpful for your daily MySQL and MariaDB management or if you need to enable the audit log in MySQL 8.0.* servers.


Percona offers secure, tested, open source software complete with advanced features like backup, monitoring, and encryption only otherwise found in MySQL Enterprise Edition.

 

Learn Why Customers Choose Percona for MySQL

Subscribe
Notify of
guest

2 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Rufus

Thanks for this post Mr. Larry Xia/Percona team.
Does this same strategy work for MySQL 5.7 ?

Dhivya

Hello Larry,
Can we use Percona MySQL 8.0.40 audit log plugin for all MySQL Community Edition minor versions within the 8.0 series?