Public bug reported: We keep receiving cron messages from our tomcat machines:
/etc/cron.daily/tomcat7: gzip: /var/log/tomcat7/lnhpd-catalina.2016-08-15.log.gz already exists; not overwritten And when looking at /var/log/tomcat7: # ll /var/log/tomcat7/lnhpd-catalina.2016-08-15.* -rw-r--r-- 1 tomcat7 tomcat7 143355 Aug 17 08:22 /var/log/tomcat7/lnhpd-catalina.2016-08-15.log -rw-r--r-- 1 tomcat7 tomcat7 10605 Aug 15 23:56 /var/log/tomcat7/lnhpd-catalina.2016-08-15.log.gz We notice the uncompressed file was created on Aug 17th despite what the date embedded in the file name says. On Aug 17th, at 8:22, the tomcat7 service was manually restarted due to security update to OpenJDK-7. This seems to have trigger the problematic behavior. The first entry in the newly created is from the 17th: # head -1 /var/log/tomcat7/lnhpd-catalina.2016-08-15.log 2016-08-17 00:11:40,179 [http-bio-8080-exec-8] INFO ca.gc.hc.util.ApplicationGlobals- Initializing Localization to en_CA And if we look at the last entry of the previous day: # zcat /var/log/tomcat7/lnhpd-catalina.2016-08-16.log.gz | tail -1 2016-08-16 23:55:57,185 [http-bio-8080-exec-10] WARN org.apache.struts.util.PropertyMessageResources- Resource resources/ApplicationResources_fr_CA.properties Not Found. So both files have consecutive log entries but the newly created file has the wrong date embedded in its name. Having tomcat reusing old dates for new files causes problem later on when the cron job tries to compress old logs and trip on existing files. This is what generates the cron emails. Additional information on the machine: # lsb_release -rd Description: Ubuntu 14.04.5 LTS Release: 14.04 # apt-cache policy tomcat7 openjdk-7-jre-headless tomcat7: Installed: 7.0.52-1ubuntu0.6 Candidate: 7.0.52-1ubuntu0.6 Version table: *** 7.0.52-1ubuntu0.6 0 500 http://archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages 500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages 100 /var/lib/dpkg/status 7.0.52-1 0 500 http://archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages openjdk-7-jre-headless: Installed: 7u111-2.6.7-0ubuntu0.14.04.3 Candidate: 7u111-2.6.7-0ubuntu0.14.04.3 Version table: *** 7u111-2.6.7-0ubuntu0.14.04.3 0 500 http://archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages 500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages 100 /var/lib/dpkg/status 7u51-2.4.6-1ubuntu4 0 500 http://archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages ProblemType: Bug DistroRelease: Ubuntu 14.04 Package: tomcat7 7.0.52-1ubuntu0.6 ProcVersionSignature: Ubuntu 3.13.0-93.140-generic 3.13.11-ckt39 Uname: Linux 3.13.0-93-generic x86_64 ApportVersion: 2.14.1-0ubuntu3.21 Architecture: amd64 Date: Thu Aug 18 09:20:02 2016 PackageArchitecture: all ProcEnviron: TERM=xterm PATH=(custom, no user) LANG=en_CA.UTF-8 SHELL=/bin/bash SourcePackage: tomcat7 UpgradeStatus: No upgrade log present (probably fresh install) modified.conffile..etc.tomcat7.server.xml: [modified] modified.conffile..etc.tomcat7.tomcat.users.xml: [modified] mtime.conffile..etc.tomcat7.server.xml: 2016-08-15T10:35:37.546984 mtime.conffile..etc.tomcat7.tomcat.users.xml: 2016-01-26T13:16:49.046413 ** Affects: tomcat7 (Ubuntu) Importance: Undecided Status: New ** Tags: amd64 apport-bug trusty -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1614536 Title: cron logrotation fail on existing files To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/tomcat7/+bug/1614536/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs