Cutting tomcat log files with Logrotate

Source: Internet
Author: User

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
      1. Rotate 31 indicates a 31-day backup file is reserved
      2. Daily says to tidy up once a day
      3. Copytruncate means to copy the contents of the log file before emptying
      4. Compress indicates a compressed spare file
      5. Missingok says if you can't find the log file, it's not OK.
      6. Notifempty indicates that if the log file is empty, it will not be rotate
      7. Dateext indicates the log file suffix format of the backup

Cutting tomcat log files with Logrotate

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.