What is rotating Tomcat log files?

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.

Asked By: dr_


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…

Answered By: Stephen Kitt
Categories: Answers Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.