RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1701249 - tomcat doesn't clean own logs by logrotate
Summary: tomcat doesn't clean own logs by logrotate
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: tomcat
Version: 7.6
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Coty Sutherland
QA Contact: tomcat-qe
URL:
Whiteboard:
Depends On:
Blocks: 1722607
TreeView+ depends on / blocked
 
Reported: 2019-04-18 13:45 UTC by Markus Schibli
Modified: 2023-09-07 19:56 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-03-04 21:00:41 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Output of the /var/log/tomcat directory (124.08 KB, text/plain)
2019-04-18 13:45 UTC, Markus Schibli
no flags Details

Description Markus Schibli 2019-04-18 13:45:26 UTC
Created attachment 1556136 [details]
Output of the /var/log/tomcat directory

Description of problem:
I look at system where the tomcat has run for long time. And a lot of old log files exist, I suppose that the logs should be cleaned.

>> ls  /var/log/tomcat/

total 931192    <<<<<<<<<<<<<see the high amount of files (!)
-rw-r--r-- 1 tomcat tomcat     18938 Sep 28  2016 catalina.2016-09-28.log
-rw-r--r-- 1 tomcat tomcat     28648 Sep 29  2016 catalina.2016-09-29.log
-rw-r--r-- 1 tomcat tomcat      9461 Sep 30  2016 catalina.2016-09-30.log
-rw-r--r-- 1 tomcat tomcat      9675 Oct  1  2016 catalina.2016-10-01.log
-rw-r--r-- 1 tomcat tomcat      9925 Oct  3  2016 catalina.2016-10-03.log
-rw-r--r-- 1 tomcat tomcat      9478 Oct  4  2016 catalina.2016-10-04.log
-rw-r--r-- 1 tomcat tomcat     67972 Oct  5  2016 catalina.2016-10-05.log
-rw-r--r-- 1 tomcat tomcat      9670 Oct  6  2016 catalina.2016-10-06.log
-rw-r--r-- 1 tomcat tomcat      9674 Oct  7  2016 catalina.2016-10-07.log
-rw-r--r-- 1 tomcat tomcat      9674 Oct  8  2016 catalina.2016-10-08.log
-rw-r--r-- 1 tomcat tomcat      9674 Oct  9  2016 catalina.2016-10-09.log
-rw-r--r-- 1 tomcat tomcat      9727 Oct 10  2016 catalina.2016-10-10.log
-rw-r--r-- 1 tomcat tomcat      9477 Oct 11  2016 catalina.2016-10-11.log
-rw-r--r-- 1 tomcat tomcat      9674 Oct 12  2016 catalina.2016-10-12.log
-rw-r--r-- 1 tomcat tomcat      9675 Oct 13  2016 catalina.2016-10-13.log
-rw-r--r-- 1 tomcat tomcat       250 Oct 17  2016 catalina.2016-10-17.log
-rw-r--r-- 1 tomcat tomcat       250 Oct 24  2016 catalina.2016-10-24.log
-rw-r--r-- 1 tomcat tomcat       250 Oct 31  2016 catalina.2016-10-31.log
-rw-r--r-- 1 tomcat tomcat     59532 Nov  1  2016 catalina.2016-11-01.log
-rw-r--r-- 1 tomcat tomcat     28430 Nov  4  2016 catalina.2016-11-04.log
-rw-r--r-- 1 tomcat tomcat       250 Nov  7  2016 catalina.2016-11-07.log
-rw-r--r-- 1 tomcat tomcat       250 Nov 14  2016 catalina.2016-11-14.log
-rw-r--r-- 1 tomcat tomcat    237373 Nov 17  2016 catalina.2016-11-17.log
-rw-r--r-- 1 tomcat tomcat       250 Nov 21  2016 catalina.2016-11-21.log
-rw-r--r-- 1 tomcat tomcat       250 Nov 28  2016 catalina.2016-11-28.log
-rw-r--r-- 1 tomcat tomcat     34337 Nov 29  2016 catalina.2016-11-29.log
-rw-r--r-- 1 tomcat tomcat     34003 Nov 30  2016 catalina.2016-11-30.log
-rw-r--r-- 1 tomcat tomcat     61087 Dec  1  2016 catalina.2016-12-01.log
-rw-r--r-- 1 tomcat tomcat     68240 Dec  2  2016 catalina.2016-12-02.log
-rw-r--r-- 1 tomcat tomcat     34581 Dec  3  2016 catalina.2016-12-03.log
-rw-r--r-- 1 tomcat tomcat     30584 Dec  4  2016 catalina.2016-12-04.log
-rw-r--r-- 1 tomcat tomcat     32703 Dec  5  2016 catalina.2016-12-05.log
-rw-r--r-- 1 tomcat tomcat     35446 Dec  6  2016 catalina.2016-12-06.log
-rw-r--r-- 1 tomcat tomcat     35461 Dec  7  2016 catalina.2016-12-07.log
-rw-r--r-- 1 tomcat tomcat     35162 Dec  8  2016 catalina.2016-12-08.log
-rw-r--r-- 1 tomcat tomcat     79718 Dec  9  2016 catalina.2016-12-09.log
-rw-r--r-- 1 tomcat tomcat     35161 Dec 10  2016 catalina.2016-12-10.log
-rw-r--r-- 1 tomcat tomcat     31463 Dec 11  2016 catalina.2016-12-11.log
-rw-r--r-- 1 tomcat tomcat     33837 Dec 12  2016 catalina.2016-12-12.log
-rw-r--r-- 1 tomcat tomcat     34005 Dec 13  2016 catalina.2016-12-13.log
.
snip
.
-rw-r--r-- 1 tomcat tomcat         0 Mar  1 20:10 manager.2019-03-01.log
-rw-r--r-- 1 tomcat tomcat         0 Mar  2 20:11 manager.2019-03-02.log
-rw-r--r-- 1 tomcat tomcat         0 Mar  3 20:11 manager.2019-03-03.log
-rw-r--r-- 1 tomcat tomcat         0 Mar  4 20:10 manager.2019-03-04.log
-rw-r--r-- 1 tomcat tomcat         0 Mar  5 20:11 manager.2019-03-05.log
-rw-r--r-- 1 tomcat tomcat         0 Mar  6 07:32 manager.2019-03-06.log
-rw-r--r-- 1 tomcat tomcat         0 Mar  7 20:09 manager.2019-03-07.log
-rw-r--r-- 1 tomcat tomcat         0 Mar  8 20:11 manager.2019-03-08.log
-rw-r--r-- 1 tomcat tomcat         0 Mar  9 20:09 manager.2019-03-09.log
-rw-r--r-- 1 tomcat tomcat         0 Mar 10 20:10 manager.2019-03-10.log
-rw-r--r-- 1 tomcat tomcat         0 Mar 11 20:11 manager.2019-03-11.log
-rw-r--r-- 1 tomcat tomcat         0 Mar 12 20:10 manager.2019-03-12.log
-rw-r--r-- 1 tomcat tomcat         0 Mar 13 20:10 manager.2019-03-13.log
-rw-r--r-- 1 tomcat tomcat         0 Mar 14 13:46 manager.2019-03-14.log
-rw-r--r-- 1 tomcat tomcat         0 Mar 15 20:10 manager.2019-03-15.log
-rw-r--r-- 1 tomcat tomcat         0 Mar 16 20:10 manager.2019-03-16.log
-rw-r--r-- 1 tomcat tomcat         0 Mar 17 20:11 manager.2019-03-17.log
-rw-r--r-- 1 tomcat tomcat         0 Mar 18 20:12 manager.2019-03-18.log
-rw-r--r-- 1 tomcat tomcat         0 Mar 19 20:12 manager.2019-03-19.log
-rw-r--r-- 1 tomcat tomcat         0 Mar 20 20:11 manager.2019-03-20.log
-rw-r--r-- 1 tomcat tomcat         0 Mar 21 20:10 manager.2019-03-21.log
-rw-r--r-- 1 tomcat tomcat         0 Mar 22 20:11 manager.2019-03-22.log
-rw-r--r-- 1 tomcat tomcat         0 Mar 23 20:09 manager.2019-03-23.log
-rw-r--r-- 1 tomcat tomcat         0 Mar 24 20:11 manager.2019-03-24.log
-rw-r--r-- 1 tomcat tomcat         0 Mar 25 20:11 manager.2019-03-25.log
-rw-r--r-- 1 tomcat tomcat         0 Mar 26 20:12 manager.2019-03-26.log
-rw-r--r-- 1 tomcat tomcat         0 Mar 27 20:12 manager.2019-03-27.log
-rw-r--r-- 1 tomcat tomcat         0 Mar 28 10:19 manager.2019-03-28.log
-rw-r--r-- 1 tomcat tomcat         0 Mar 29 20:11 manager.2019-03-29.log
-rw-r--r-- 1 tomcat tomcat         0 Mar 31 20:12 manager.2019-03-31.log
-rw-r--r-- 1 tomcat tomcat         0 Apr  1 07:11 manager.2019-04-01.log
-rw-r--r-- 1 tomcat tomcat         0 Apr  2 09:30 manager.2019-04-02.log
-rw-r--r-- 1 tomcat tomcat         0 Apr  3 14:26 manager.2019-04-03.log
-rw-r--r-- 1 tomcat tomcat         0 Apr  4 07:30 manager.2019-04-04.log

$ cat etc/logrotate.d/tomcat 
/var/log/tomcat/catalina.out {
    copytruncate
    weekly
    rotate 52
    compress
    missingok
    create 0644 tomcat tomcat
}


Version-Release number of selected component (if applicable):

$ cat etc/redhat-release 
Red Hat Enterprise Linux Server release 7.6 (Maipo)

$ grep -i tomcat installed-rpms 
lh555.server.raiffeisen.ch-tomcat-1.0-1.noarch              Tue Feb 13 07:04:46 2018
tomcat-7.0.76-8.el7_5.noarch                                Wed Nov 14 09:19:38 2018
tomcat-el-2.2-api-7.0.76-8.el7_5.noarch                     Wed Nov 14 09:18:39 2018
tomcat-jsp-2.2-api-7.0.76-8.el7_5.noarch                    Wed Nov 14 09:18:05 2018
tomcat-lib-7.0.76-8.el7_5.noarch                            Wed Nov 14 09:18:40 2018
tomcat-servlet-3.0-api-7.0.76-8.el7_5.noarch                Wed Nov 14 09:18:04 2018


How reproducible:
alawys

Steps to Reproduce:
1. run tomcat long time
2. show content of directory with logs 


Actual results:
A lot of logs files

Expected results:
old log files was compressed or remove


Additional info:

The same bug was opened for rhel 6.9 but was closed as WONTFIX due to "Red Hat Enterprise Linux 6 is in the Production 3 Phase."

Comment 2 Markus Schibli 2019-04-18 13:47:20 UTC
mentioned closed BZ was https://bugzilla.redhat.com/show_bug.cgi?id=1451314

Comment 3 Coty Sutherland 2019-04-18 15:33:56 UTC
I provided a patch suggestion on the rhel-6 issue, https://bugzilla.redhat.com/show_bug.cgi?id=1451314#c2. I'm not sure if it's feasible or not (it never got reviewed), but I'll look into it for rhel-7.

Comment 4 Coty Sutherland 2020-03-04 21:00:33 UTC
The proposed solution from rhbz#1451314 was to add *.log to the logrotate configuration:

~~~
/var/log/tomcat/catalina.out 
/var/log/tomcat/*.log
{
    copytruncate
    weekly
    rotate 52
    compress
    missingok
    create 0644 tomcat tomcat
}
~~~

Users are free to go that route, however it will likely interfere with tomcat's ability to rotate it's own logs. The better solution to the problem of having too many logs after long periods of time is to utilize the o.a.juli.FileHandler's maxDays attribute (see https://tomcat.apache.org/tomcat-7.0-doc/api/org/apache/juli/FileHandler.html) to limit the number of logs kept. By default it keeps them forever, which is why there are a lot of long files after several days. If users want to use logrotate instead, then they should set the rotatable attribute of the FileHandler to false rather than true which will prevent tomcat from rotating it's own logs and allow the file management to fall to logrotate.

Comment 5 RHEL Program Management 2020-03-04 21:00:41 UTC
Development Management has reviewed and declined this request. You may appeal this decision by using your Red Hat support channels, who will make certain  the issue receives the proper prioritization with product and development management.

https://www.redhat.com/support/process/production/#howto


Note You need to log in before you can comment on or make changes to this bug.