I deployed MariaDB with Docker in Unraid, I know that the best choice is solving errors in the log. But I still want to rotate the error log.
I created the following configuration file native to Unraid(/etc/logrotate.d/mariadb):
su nobody users
create 660 nobody users
createolddir 770 nobody users
# just if mysqld is really running
if docker exec mariadb test -x /usr/bin/mysqladmin && \
/docker exec mariadb usr/bin/mysqladmin ping &>/dev/null
/docker exec mariadb usr/bin/mysqladmin --local flush-error-log \
flush-engine-log flush-general-log flush-slow-log
logrotate --force /etc/logrotate.d/mariadb, everything seemed OK only that the new logs were still appended to the archived file, the mariadb.err file was empty.