Hi,
I would like to use logrotate to perform log rotation of audit log generated by Percona’s audit log filter component (MySQL 8.4).
when the format is set to JSON, I notice the file begins with ‘[‘ which indicate that the whole file will be a JSON array.
any recommendations?
Hi @Charly_Wu and welcome back to Percona community.
You might want to use the inbuild configuration for the rotation: audit_log_rotate_on_size, audit_log_rotations.
You have dedicated section in documentation for audit log rotation:
Thanks,
Kedar
Hi @Charly_Wu ,
we’ve moved away from logrotate and simply do this with a nightly cron job;
SELECT audit_log_rotate();
I recommend to have an own user for this, just granted with AUDIT_ADMIN permissions.
Alternatively, you could even execute this from a scheduled event:
CREATE EVENT IF NOT EXISTS audit_log_rotate_nightly ON SCHEDULE EVERY 1 DAY STARTS ‘2025-07-31 00:00:00’ COMMENT ‘daily audit-log rotation’ DO SELECT audit_log_rotate();
Sebastian