Logrotate files with date in the file name

后端 未结 11 858
孤城傲影
孤城傲影 2020-12-13 05:08

I am trying to configure logrotate in RHEL for tomcat6 logs. Currently, logrotate works fine for catalina.out log, it is rotated and compressed properly.

The problem

11条回答
  •  悲&欢浪女
    2020-12-13 05:36

    Also, you can add crons instead hardcode logrotate.

    1 0 * * * /usr/bin/find /var/log/tomcat/ -mtime +30 -delete
    2 0 * * * /usr/bin/find /var/log/tomcat/ -mtime +1 -exec gzip -q {} \;
    

    In this way, you will delete the logs older than 30 days, and zip the logs older than 1.

提交回复
热议问题