Two WHM Backup log files taking up 160G

tntramsey

Registered
Sep 27, 2013
4
0
1
cPanel Access Level
Root Administrator
Hello,

I have been running backups of a dedicated server for a while now and I have extrememly large .log files. I am surprised at how large they accumulate to and wondering if it is ok to just delete them.

./backup/cpbackup/daily/dirs/_var_lib_mysql_/servername.log: 90G
./backup/cpbackup/weekly/dirs/_var_lib_mysql_/servername.log: 90G


Anyone have any advice?

Thanks,
Tim
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,201
363
Hello :)

Those are backups of your MySQL error log. You are welcome to remove that file if you do not require a backup for it.

Thank you.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,201
363
Are you referring to the MySQL error log itself, or the backed up version of the file?

Thank you.
 

tntramsey

Registered
Sep 27, 2013
4
0
1
cPanel Access Level
Root Administrator
For informational purposes - both, but I assume that the error log itself will automatically populate.

If I remove the backup, will it cease to backup mysql error log? What do most people/companies do about this, because as we can see I have 180G of space taken up with two backup files.

I really appreciate your input!
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,201
363
Check your /etc/my.cnf file to see if you are logging slow queries. That could be what's making your MySQL error log use so much space. Beyond that, you could add your MySQL error log to your logrotate configuration if you have logrotate installed. This would prevent it from ever reaching a large size, and negate the need to delete it or exclude it from your backups. Also, you can configure MySQL to store the log in another directory outside of /var/lib/mysql so that it's not included when the entire MySQL directory is backed up.

Thank you.
 

tntramsey

Registered
Sep 27, 2013
4
0
1
cPanel Access Level
Root Administrator
Check your /etc/my.cnf file to see if you are logging slow queries. That could be what's making your MySQL error log use so much space. Beyond that, you could add your MySQL error log to your logrotate configuration if you have logrotate installed. This would prevent it from ever reaching a large size, and negate the need to delete it or exclude it from your backups. Also, you can configure MySQL to store the log in another directory outside of /var/lib/mysql so that it's not included when the entire MySQL directory is backed up.

Thank you.
So is "error_log" the box that I should check to rotate the mysql log file? So from reading, it looks like it will compress it and store it in "/usr/local/cpanel/logs/archive/" after it reaches the threshold, and I would be responsible for going in and deleting from there?

Any input would be appreciated.

Thanks!
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,201
363
No, the log rotation files you see in Web Host Manager are not associated with MySQL. You would need to configure LogRotate manually to ensure your MySQL error log is rotated.

Thank you.