sudo apt-get install logrotate
Дальше создаем файл конфигурации logrotate (по одному для каждого места хрранения логов):
alexander@alexander-1225C /etc/logrotate.d $ sudo nano testsite
/home/alexander/WWW/tessitei/*.log {
size 100k
missingok
rotate 10
compress
delaycompress
notifempty
sharedscripts
postrotate
/etc/init.d/apache2 reload > /dev/null
endscript
}
Подробнее про параметры можно прочитать тут:
http://debianworld.ru/articles/rotaciya-logov-s-pomoshyu-logrotate-v-debian-ubuntu/
http://www.opennet.ru/cgi-bin/opennet/man.cgi?topic=logrotate
http://wiki.enchtex.info/tools/system/logrotate
Проверяем себя:
alexander@alexander-1225C /etc/logrotate.d $ ls | grep testsite testsite
Запускаем:
alexander@alexander-1225C /etc/logrotate.d $ sudo logrotate -v -f /etc/logrotate.d/testsite
Через некоторое время:
alexander@alexander-1225C /etc/logrotate.d $ ls ~/WWW/testsite/ access.log access.log.1 error.log error.log.1 www
Источник: http://www.alib.spb.ru/blog/page/linux-mint-chast-vtoraja