How log rotation is done in Tomcat for access logs

6,004

logrotate is a tool independent from tomcat. It can be used with log files generated by any kind of applications.

You can add a rule for the access.out tomcat log file in the /etc/logrotate.d/tomcat7 logrotate configuration file. If you want to apply the same rules as for /var/log/tomcat7/catalina.out you can modify your configuration file like this:

/var/log/tomcat7/catalina.out /var/log/tomcat7/access.out{
  copytruncate
  daily
# rotate 52
  rotate 90
  compress
  missingok
  create 640 tomcat7 adm
}

Read the manual for more information.

Share:
6,004

Related videos on Youtube

Ashish Karpe
Author by

Ashish Karpe

Updated on September 18, 2022

Comments

  • Ashish Karpe
    Ashish Karpe over 1 year

    How log rotation is done in Tomcat ie catalina.out and access.out ?

    We can logrotate for catalina.out :

    # vim /etc/logrotate.d/tomcat7
    /var/log/tomcat7/catalina.out {
      copytruncate
      daily
    # rotate 52
      rotate 90
      compress
      missingok
      create 640 tomcat7 adm
    }
    

    In same way can we do it for access logs ?