cron logrotation fail on existing files
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
tomcat7 (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
We keep receiving cron messages from our tomcat machines:
/etc/cron.
gzip: /var/log/
And when looking at /var/log/tomcat7:
# ll /var/log/
-rw-r--r-- 1 tomcat7 tomcat7 143355 Aug 17 08:22 /var/log/
-rw-r--r-- 1 tomcat7 tomcat7 10605 Aug 15 23:56 /var/log/
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/
2016-08-17 00:11:40,179 [http-bio-
And if we look at the last entry of the previous day:
# zcat /var/log/
2016-08-16 23:55:57,185 [http-bio-
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-
tomcat7:
Installed: 7.0.52-1ubuntu0.6
Candidate: 7.0.52-1ubuntu0.6
Version table:
*** 7.0.52-1ubuntu0.6 0
500 http://
500 http://
100 /var/lib/
7.0.52-1 0
500 http://
openjdk-
Installed: 7u111-2.
Candidate: 7u111-2.
Version table:
*** 7u111-2.
500 http://
500 http://
100 /var/lib/
7u51-
500 http://
ProblemType: Bug
DistroRelease: Ubuntu 14.04
Package: tomcat7 7.0.52-1ubuntu0.6
ProcVersionSign
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
PackageArchitec
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.
modified.
mtime.conffile.
mtime.conffile.
To silence the cron messages, an easy workaround is to disable log compression in /etc/default/ tomcat7 by setting "LOGFILE_ COMPRESS= 0". This will bypass the problematic section of /etc/cron. daily/tomcat7.
I check the cron job from tomcat8 and it is identical so maybe the problem also affects it. It all depends if the fresh logs can still be created with old dates embedded in their names or not.