20140421 rotating mysqld logs - plembo/onemoretech GitHub Wiki

title: Rotating mysqld logs link: https://onemoretech.wordpress.com/2014/04/21/rotating-mysqld-logs/ author: phil2nc description: post_id: 7414 created: 2014/04/21 11:59:34 created_gmt: 2014/04/21 15:59:34 comment_status: closed post_name: rotating-mysqld-logs status: publish post_type: post

Rotating mysqld logs

Had this logrotate script in place for awhile, before Red Hat started pushing one in RHEL 6.5 (Santiago).

/var/log/mysqld.log {
        create 640 mysql mysql
        notifempty
    daily
        rotate 3
        missingok
        compress
    postrotate
    # just if mysqld is really running
    if test -x /usr/bin/mysqladmin && \
       /usr/bin/mysqladmin ping &>/dev/null
    then
       /usr/bin/mysqladmin flush-logs
    fi
    endscript
}

The above was lifted out of /etc/logroate.d/mysqld in Fedora 19. It was nice to see it now included in the latest updates because that leaves one less set of logs to maintain outside the logrotate system.

Copyright 2004-2019 Phil Lembo