#使用logrotate分割tomcat日志
#添加tomcat文件在logrotate.d目录下:
[root@localhost logrotate.d]# cat /etc/logrotate.d/tomcat
/opt/tomcat6/logs/catalina.out{
rotate 2
copytruncate
nocompress
notifempty
missingok
nomail
noolddir
daily
dateext
}
添加定时任务:
# crontab -l
59 23 * * * /usr/sbin/logrotate -vf /etc/logrotate.conf >/dev/null 2>&1
立即截断日志:
# logrotate --force /etc/logrotate.d/tomcat
原文地址:http://wangqh.blog.51cto.com/5367393/1760395