0

This question already has an answer here:

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.

marked as duplicate by Jeff Schaller, Anthony Geoghegan, Christopher, Community Feb 6 at 16:43

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.