My Oracle Support Banner

How To Properly Configure Logrotate for MySQL Server (Doc ID 2750571.1)

Last updated on OCTOBER 16, 2023

Applies to:

MySQL Server - Version 4.0 and later
Information in this document applies to any platform.

Goal

The server log maintenance is a prominent task for a DBA. Logrotate is a very popular tool in Linux to keep the server logs for certain period, and purge unnecessary logs to prevent from wasting disks pace. Logrotate is very useful, but it needs some attention to avoid problems. This document describe how to setup logrotate properly for each log type.

Solution

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Goal
Solution
 Typical Configuration And Logrotate Options
 File Structure
 Major Options
 hourly, daily, weekly, monthly, yearly
 size N
 rotate N
 create [MODE] OWNER GROUP/nocreate
 ifempty/notifempty
 missingok/nomissingok
 maxage N
 compress/nocompress
 copy/nocopy/copytruncate/nocopytruncate
 prerotate/postrotate
 Error Log, Slow Query Log, General Query Log
 Binary Log, Relay Log
 Audit Log
 Further Considerations
References

My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.