• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

The Geek Diary

CONCEPTS | BASICS | HOWTO

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • Linux Services
    • VCS
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
    • Data Guard
  • DevOps
    • Docker
    • Shell Scripting
  • Interview Questions
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How To Purge Audit Logs in MySQL

By admin

There is no built-in support in MySQL for purging the audit log, so it is necessary to implement the purging yourself. The steps are:

1. Ensure the audit logs are rotated. You can either use an automatic rotation on size or manually purge at regular intervals:

How To Rotate the MySQL Enterprise Audit Log Plugin Log Based On Size

2. Use cron or another means of scheduling a recurring event in the operating system and use that to delete the audit logs that should be purged. For example if you are using Linux and want to delete all audit logs at least four days old, you can use the find utility like:

# find /var/lib/mysql/ -maxdepth 1 -name 'audit.log.*.xml' -mtime +3 -delete

assuming the audit logs are stored on /var/lib/mysql – otherwise replace the path.

Note: Consider archiving the old audit logs on a different hos before deleting them. The audit logs will in general also compress very well.

Filed Under: mysql

Some more articles you might also be interested in …

  1. MySQL : How To Find the Slowest Queries
  2. CentOS / RHEL 6 : How to Start/Stop MySQL Server (mysqld)
  3. How to reset MySQL database root password
  4. MySQL Fails to Start Using systemctl On systemd Linux Distributions
  5. How to Perform a Rolling Restart of MySQL NDB Cluster
  6. How to Restore a Cluster Slave Using its Own Backups
  7. Beginners Guide to Implementing Table Maintenance in MySQL
  8. MySQL Interview Questions : Multi-source Replication in MySQL Server
  9. What are Reserved User Accounts in MySQL
  10. Beginners Guide to Storage Engines in MySQL

You May Also Like

Primary Sidebar

Recent Posts

  • How to Disable IPv6 on Ubuntu 18.04 Bionic Beaver Linux
  • How to Capture More Logs in /var/log/dmesg for CentOS/RHEL
  • Unable to Start RDMA Services on CentOS/RHEL 7
  • How to rename a KVM VM with virsh
  • Archives
  • Contact Us
  • Copyright

© 2021 · The Geek Diary