My Oracle Support Banner

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

Last updated on MAY 16, 2022

Applies to:

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


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.


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
 Typical Configuration And Logrotate Options
 File Structure
 Major Options
 hourly, daily, weekly, monthly, yearly
 size N
 rotate N
 create [MODE] OWNER GROUP/nocreate
 maxage N
 Error Log, Slow Query Log, General Query Log
 Binary Log, Relay Log
 Audit Log
 Further Considerations

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