Bug#1008668: tomcat9: logrotated is not able to truncate catalina.out. Please see LP: #1964881
Evren Yurtesen
eyurtese at abo.fi
Wed Mar 30 12:00:00 BST 2022
Package: tomcat9
Severity: normal
Tags: patch
User: ubuntu-devel at lists.ubuntu.com
Usertags: origin-ubuntu jammy ubuntu-patch
Dear Maintainer,
*** Reporter, please consider answering these questions, where appropriate ***
* What led up to the situation?
Installed tomcat9 package
* What exactly did you do (or not do) that was effective (or
ineffective)?
logrotate -f /etc/logrotate.d/tomcat9
* What was the outcome of this action?
catalina.out was copied to catalina.out.1 but catalina.out was not truncated.
* What outcome did you expect instead?
after copying contents of catalina.out, it should have been truncated.
*** End of the template - remove these template lines ***
*** /tmp/tmprta9fb7b/bug_body
In Ubuntu, the attached patch was applied to achieve the following:
The patch causes rsyslogd to write the file as syslog:adm and logrotated to rotate the file as syslog.
Without the patch, logrotated is not able to rotate file owned by syslog which is created by rsyslogd
* Fix logrotated not able to truncate cataline.out (LP: #1964881)
Thanks for considering the patch.
-- System Information:
Debian Release: bookworm/sid
APT prefers jammy
APT policy: (500, 'jammy')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 5.15.0-23-generic (SMP w/8 CPU threads)
Kernel taint flags: TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
-------------- next part --------------
diff -Nru tomcat9-9.0.58/debian/logrotate.template tomcat9-9.0.58/debian/logrotate.template
--- tomcat9-9.0.58/debian/logrotate.template 2022-02-09 16:51:20.000000000 +0200
+++ tomcat9-9.0.58/debian/logrotate.template 2022-03-28 14:00:25.000000000 +0300
@@ -5,6 +5,6 @@
compress
delaycompress
missingok
- create 640 tomcat adm
- su tomcat adm
+ create 640 syslog adm
+ su syslog adm
}
diff -Nru tomcat9-9.0.58/debian/rsyslog/tomcat9.conf tomcat9-9.0.58/debian/rsyslog/tomcat9.conf
--- tomcat9-9.0.58/debian/rsyslog/tomcat9.conf 2022-02-09 16:51:20.000000000 +0200
+++ tomcat9-9.0.58/debian/rsyslog/tomcat9.conf 2022-03-28 14:00:25.000000000 +0300
@@ -2,6 +2,6 @@
$template TomcatFormat,"[%timegenerated:::date-year%-%timegenerated:::date-month%-%timegenerated:::date-day% %timegenerated:::date-hour%:%timegenerated:::date-minute%:%timegenerated:::date-second%] [%syslogseverity-text%]%msg%\n"
:programname, startswith, "tomcat9" {
- action(type="omfile" file="/var/log/tomcat9/catalina.out" Template="TomcatFormat" fileOwner="tomcat" fileCreateMode="0640")
+ action(type="omfile" file="/var/log/tomcat9/catalina.out" Template="TomcatFormat" fileOwner="syslog" fileCreateMode="0640")
stop
}
More information about the pkg-java-maintainers
mailing list