Full-service Internet Marketing & Web Development
Recent Posts

Sponsors
![]() |
MySQL log rotateChris Tata, 03-06-2007 |
I've been getting weekly emails from our ISP about one of the MySQL database machines constantly running out of space.
Every other week I would go in and manually delete the mysqld.log log file. Got tired of doing this manually and worrying about it, so I wrote a simple script to automatically rotate MySQL log file.
I rotated the file (52gb) by hand and updated /etc/newsyslog.conf to include rotation of mysqld.log:
[root@spidb /var/log]# cat /etc/newsyslog.conf |grep sql
/var/log/mysqld.log mysql:wheel 660 4 * $D0 Z
Meaning "rotate mysqld.log every day at 00:00, save 4 days worth, change ownership to mysql:wheel with mode 660 and compress with gzip".
Had to also send a HUP signal to syslogd to reread the config file.
Every other week I would go in and manually delete the mysqld.log log file. Got tired of doing this manually and worrying about it, so I wrote a simple script to automatically rotate MySQL log file.
I rotated the file (52gb) by hand and updated /etc/newsyslog.conf to include rotation of mysqld.log:
[root@spidb /var/log]# cat /etc/newsyslog.conf |grep sql
/var/log/mysqld.log mysql:wheel 660 4 * $D0 Z
Meaning "rotate mysqld.log every day at 00:00, save 4 days worth, change ownership to mysql:wheel with mode 660 and compress with gzip".
Had to also send a HUP signal to syslogd to reread the config file.
|
|
Subscribe Now to receive new posts via Email as soon as they come out.
Comments
Post your comments

