• 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. How to reset MySQL database root password
  2. MySQL 8.0 : Persisted Variables
  3. Can MySQL Cluster Run Multiple Nodes On a Single Server
  4. mysqldump – How to Restore a Specific Database From a Backup of All Databases
  5. How To Skip a Transaction on MySQL replication slave When GTIDs Are Enabled
  6. How to Change Default Character Sets in MySQL using ALTER TABLE Statement
  7. How to Change the Default Character Set and Collation for a Database in MySQL
  8. How to use foreign keys to attain referential integrity in MySQL
  9. How To Start And Stop MySQL Cluster
  10. Beginners Guide to MySQL Data Types

You May Also Like

Primary Sidebar

Recent Posts

  • Basics of client connectivity in Oracle Data Guard configuration
  • ORA-354 ORA-353 and ORA-312: Possible corruption in Online Redo Log File Members in a Redo Log Group
  • How to relocate the redo log files to a different location on disk
  • Oracle Database: Redo log operations (Add/Drop/Change Location)
  • Archives
  • Contact Us
  • Copyright

© 2021 · The Geek Diary