In Ubuntu 20.04, with `tomcat9-9.0.31-1ubuntu0.1` (latest) package, `logrotated` is not able to write to `/var/log/tomcat/catalina.out`
In Ubuntu 22.04, with `tomcat9-9.0.58-1` (latest) package, `logrotated` is not able to rotate `/var/log/tomcat/catalina.out`
The reason of missing `catalina.out` in Ubuntu 20.04 is that the `/var/log/tomcat` does not have group write permission. Therefore `syslog` user which executes `rsyslogd` is not able to write to `/var/log/tomcat` folder.
A common problem between Ubuntu 20.04/22.04 is that the `/etc/rsyslog.d/tomcat9.conf` file does not have the following setting: `fileOwner="tomcat"` (which exists in upstream Debian `tomcat9` package supplied `/etc/rsyslog.d/tomcat9.conf` file)
Because of the missing `fileOwner` setting, the `catalina.out` is created with `syslog:adm` ownerships. However the `/etc/logrotate.d/tomcat9` has `su tomcat adm` directive. Therefore the `logrotated` is not able to truncate the `/var/log/tomcat/catalina.out`
This causes logrotate to copy the contents of `/var/log/tomcat/catalina.out` to as if it would be rotated. As `catalina.out` is never truncated, each rotated file ends up having the contents of `catalina.out` from the beginning of the tomcat installation. This causes the log sizes to keep increasing as no actual log rotation is being done.
In Ubuntu 20.04, with `tomcat9- 9.0.31- 1ubuntu0. 1` (latest) package, `logrotated` is not able to write to `/var/log/ tomcat/ catalina. out`
In Ubuntu 22.04, with `tomcat9-9.0.58-1` (latest) package, `logrotated` is not able to rotate `/var/log/ tomcat/ catalina. out`
The reason of missing `catalina.out` in Ubuntu 20.04 is that the `/var/log/tomcat` does not have group write permission. Therefore `syslog` user which executes `rsyslogd` is not able to write to `/var/log/tomcat` folder.
A common problem between Ubuntu 20.04/22.04 is that the `/etc/rsyslog. d/tomcat9. conf` file does not have the following setting: `fileOwner= "tomcat" ` (which exists in upstream Debian `tomcat9` package supplied `/etc/rsyslog. d/tomcat9. conf` file)
Because of the missing `fileOwner` setting, the `catalina.out` is created with `syslog:adm` ownerships. However the `/etc/logrotate .d/tomcat9` has `su tomcat adm` directive. Therefore the `logrotated` is not able to truncate the `/var/log/ tomcat/ catalina. out`
This causes logrotate to copy the contents of `/var/log/ tomcat/ catalina. out` to as if it would be rotated. As `catalina.out` is never truncated, each rotated file ends up having the contents of `catalina.out` from the beginning of the tomcat installation. This causes the log sizes to keep increasing as no actual log rotation is being done.