V
V
vlarkanov2018-10-24 11:33:40
linux
vlarkanov, 2018-10-24 11:33:40

MySQL (Percona XtreDB Cluster) - how to properly rotate logs?

Actually, subject. OS Debian 9
I would like to create a new one when reaching /var/log/mysqld.log, for example, 100mb, and shove the old one into gz and store 10 files in total.
Basically, it should look something like
/var/mysql/mysqld.log {
compress
create 660 mysql mysql
size 100M
missingok
notifempty
rotate 10
}
But surely something needs to be done in postrotate. Please share your methods / config examples.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
vman, 2018-10-24
@vlarkanov

/var/lib/mysql/mysqld.log {
    .....
    postrotate
        if test -x /usr/bin/mysqladmin && /usr/bin/mysqladmin ping &>/dev/null
        then
            /usr/bin/mysqladmin flush-logs
        fi
    endscript
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question