logrotate not able to truncate catalina.out
The problem got resolved after changing the permissions of /etc/logrotate.d/tomcat
file.
Before:
$ ls -lht /etc/logrotate.d/tomcat
-rwxr-xr-x 1 root root 308 Apr 25 2018 /etc/logrotate.d/tomcat
After:
$ sudo chmod -x /etc/logrotate.d/tomcat
$ ls -lht /etc/logrotate.d/tomcat
-rw-r--r-- 1 root root 308 Apr 25 2018 /etc/logrotate.d/tomcat
Got to know about it after checking verbose of logrotate
.
$ /usr/sbin/logrotate -v /etc/logrotate.conf
Related videos on Youtube
Comments
-
pkgajulapalli over 1 year
I'm running tomcat server in my centos machine. I've following content in my
/etc/logrotate.d/tomcat
file:/log/apache-tomcat/catalina.out{ copytruncate daily size 256M rotate 8 missingok maxage 7 }
I tried to run the
logrotate
command manually in debug mode./usr/sbin/logrotate -d /etc/logrotate.conf
In the logs, I found following content regarding the
/log/apache-tomcat/catalina.out
file.rotating pattern: /log/apache-tomcat/catalina.out 268435456 bytes (8 rotations)
empty log files are rotated, old logs are removed
considering log /log/apache-tomcat/catalina.out log needs rotating
rotating log /log/apache-tomcat/catalina.out, log->rotateCount is 8
dateext suffix '-20190206'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
glob finding old rotated logs failed
copying /log/apache-tomcat/catalina.out to /log/apache-tomcat/catalina.out-20190206
truncating /log/apache-tomcat/catalina.out
But the file size didn't change after running the command. I'm not sure what went wrong here. This file size is keep on increasing and causing lot of issues.