MariaDB mariadb configuration example for Debian GNU/Linux 11 (bullseye)

Get the default configuration file mariadb for MariaDB, optimized for Debian GNU/Linux 11 (bullseye). This example configuration ensures optimal compatibility and performance for MariaDB, making it easy to set up and adjust to meet your needs.

Find and download the configuration file here: /etc/logrotate.d/mariadb.

For more configurations and setup guides, visit our related files section to further customize your system.

    # This is the MariaDB configuration for the logrotate utility
#
# Note that on most Linux systems logs are written to journald, which has its
# own rotation scheme.
#
# Read https://mariadb.com/kb/en/error-log/ to learn more about logging and
# https://mariadb.com/kb/en/rotating-logs-on-unix-and-linux/ about rotating logs.

/var/lib/mysql/mysqld.log /var/log/mysql/mysql.log /var/lib/mysql/mariadb.log /var/log/mysql/mysql-slow.log /var/log/mysql/mariadb-slow.log /var/log/mysql/error.log {

  # If any of the files listed above is missing, skip them silently without
  # emitting any errors
  missingok

  # If file exists but is empty, don't rotate it
  notifempty

  # Run monthly
  monthly

  # Keep 6 months of logs
  rotate 6

  # If file is growing too big, rotate immediately
  maxsize 500M

  # If file size is too small, don't rotate at all
  minsize 50M

  # Compress logs, as they are text and compression will save a lot of disk space
  compress

  # Don't compress the log immediately to avoid errors about "file size changed while zipping"
  delaycompress

  # Don't run the postrotate script for each file configured in this file, but
  # run it only once if one or more files were rotated
  sharedscripts

  # After each rotation, run this custom script to flush the logs. Note that
  # this assumes that the mariadb-admin command has database access, which it
  # has thanks to the default use of Unix socket authentication for the 'root'
  # account used everywhere since MariaDB 10.4.
  postrotate
    if test -x /etc/mysql/debian.cnf
    then
      EXTRAPARAM='--defaults-file=/etc/mysql/debian.cnf'
    fi

    if test -x /usr/bin/mariadb-admin
    then
      /usr/bin/mariadb-admin $EXTRAPARAM --local flush-error-log \
        flush-engine-log flush-general-log flush-slow-log
    fi
  endscript
}

    
  

Config Details

Location
/etc/logrotate.d/mariadb
Operating system
Debian GNU/Linux 11 (bullseye)
Length
56 lines
MD5 checksum
ed3eeec8113299d0c18249bb70eaa91c

Usage

Download the raw file with wget or curl

Wget

wget -O mariadb.example https://exampleconfig.com/static/raw/mariadb/debian11/etc/logrotate.d/mariadb

cURL

curl https://exampleconfig.com/static/raw/mariadb/debian11/etc/logrotate.d/mariadb > mariadb.example