Recently because Tomcat's catalina.out log is too large, you need to do a cut using the Logrotate cut method as follows: 1. Add Project ProfileCD/ETC/LOGROTATE.DAdd Inceptor file/usr/local/tomcat7.inceptor-web_8080/logs/catalina.out {
#rotate 31
Daily
copytruncate
Compress
Notifempty
Missingok
Dateext
}
2. Add Crontab 0 0 * * */usr/sbin/logrotate-f/etc/logrotate.conf >/dev/null 2>&1
3, will generate a compressed package/usr/local/tomcat7.inceptor-web_8080/logs/catalina.out-20151119.gz 4, configuration file description
- Rotate 31 indicates a 31-day backup file is reserved
- Daily says to tidy up once a day
- Copytruncate means to copy the contents of the log file before emptying
- Compress indicates a compressed spare file
- Missingok says if you can't find the log file, it's not OK.
- Notifempty indicates that if the log file is empty, it will not be rotate
- Dateext indicates the log file suffix format of the backup
Cutting tomcat log files with Logrotate