MySQL logrotate 후 새로운 파일에 로그 기록이 안되는 경우

logrotate 이후에 로그가 새로운 파일에 기록이 되지 않고 기존 파일에 계속 기록이 되는 문제
해결방법:
– env HOME=/root/ 이 중요하다.
아래 코드로 다시 Log Rotate 파일을 만들어주자.

cd /etc/logrotate.d/
vim mysql

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

 

참고: MySQL doesn’t logs error to new file after rotating?
http://serverfault.com/questions/415774/mysql-doesnt-logs-error-to-new-file-after-rotating

MySQL logrotate 후 새로운 파일에 로그 기록이 안되는 경우
Scroll to top