What is rotating Tomcat log files?

7,380

Tomcat rotates its log files itself: by default at least localhost_access_log_ (configured using an AccessLogValve in server.xml, look in /opt/alfresco/tomcat/conf) and the log files configured using a FileHandler in logging.properties (catalina.out and so on).

I'm not sure how you'd go about compressing the log files natively within Tomcat's logging framework, short of adding your own handler...

Share:
7,380

Related videos on Youtube

dr_
Author by

dr_

Updated on September 18, 2022

Comments

  • dr_
    dr_ over 1 year

    One of our servers has Alfresco installed, and this is the content of /opt/alfresco/tomcat/logs:

    -rw-r--r--  1 root root 4.1K Jun 29 10:41 catalina.2015-06-29.log
    -rw-r--r--  1 root root  352 Jul  1 18:36 catalina.2015-07-01.log
    -rw-r--r--  1 root root 1.3M Jul 13 14:49 catalina.out
    -rw-r--r--  1 root root    0 Jun 29 10:38 host-manager.2015-06-29.log
    -rw-r--r--  1 root root 7.9K Jun 26 19:02 localhost.2015-06-26.log
    -rw-r--r--  1 root root  33K Jun 29 10:39 localhost.2015-06-29.log
    -rw-r--r--  1 root root  98M Jun 17 00:00 localhost_access_log.2015-06-16.txt
    -rw-r--r--  1 root root  98M Jun 18 00:00 localhost_access_log.2015-06-17.txt
    -rw-r--r--  1 root root  98M Jun 19 00:00 localhost_access_log.2015-06-18.txt
    -rw-r--r--  1 root root  98M Jun 20 00:00 localhost_access_log.2015-06-19.txt
    (...)
    -rw-r--r--  1 root root  75M Jul 12 00:00 localhost_access_log.2015-07-11.txt
    -rw-r--r--  1 root root  80M Jul 13 00:00 localhost_access_log.2015-07-12.txt
    -rw-r--r--  1 root root  85M Jul 14 00:00 localhost_access_log.2015-07-13.txt
    -rw-r--r--  1 root root  40M Jul 14 09:52 localhost_access_log.2015-07-14.txt
    -rw-r--r--  1 root root    0 Jun 29 10:38 manager.2015-06-29.log
    

    Some process is obviously rotating the logs daily. However, there's nothing operating on the Tomcat logs in /etc/logrotate.d -- or even in /etc/cron.d/ or the crontab file. Is there any setting in Tomcat or Alfresco that does this?

    I'm asking because I want to add a "compress" option. For now I've accomplished this result via a find one-liner script put as a daily cron job, but I like to do things in a cleaner way.

    • heemayl
      heemayl almost 9 years
      I am not familiar with tomcat, you can tey grep -r '/opt/alfresco/tomcat/logs' /etc to check which files have this directory name in them..it is possible that any application has its own logrotate rules..
    • dr_
      dr_ almost 9 years
      I already tried that, but there is no match for tomcat/logs in /etc or /opt.