0

It seems like there are quite a few common issues with logrotate not doing what it suppose to and as it happens I am in the same boat.

-rw-r--r-- 1 root root  24G Jun 23 01:15 A10.log
-rw-r--r-- 1 root root    0 Jun 18 12:22 A110.log
-rw-r--r-- 1 root root  18G Jun 23 01:15 A11223.log
-rw-r--r-- 1 root root    0 Jun 22 00:00 A115.log
-rw-r--r-- 1 root root  18G Jun 23 01:15 A11.log
-rw-r--r-- 1 root root 1.1G Jun 23 01:15 A202.log
-rw-r--r-- 1 root root 2.5G Jun 23 01:15 A216.log
-rw-r--r-- 1 root root 496M Jun 23 01:15 A221.log
-rw-r--r-- 1 root root  18G Jun 23 01:15 A235.log
-rw-r--r-- 1 root root 515M Jun 23 01:15 A236.log
-rw-r--r-- 1 root root  17G Jun 23 01:15 A404.log

Now the above output shows some files that are considerably large in size. Logrotate is supposed to run on a daily basis and rotate files daily and if the file is over 1GB

/var/log/tomcat/A*.log {
        daily
        missingok
        rotate 5
        compress
        maxsize 1G
        notifempty
        create 640 tomcat adm
        sharedscripts
        postrotate
                /etc/init.d/tomcat stop > /dev/null
                /etc/init.d/tomcat start > /dev/null
        endscript
}

Executing the logrotate manually gives the following output

host:/usr/share/tomcat/logs# logrotate -f --verbose /etc/logrotate.d/rotateTomcat
reading config file /etc/logrotate.d/rotateTomcat

Handling 1 logs

rotating pattern: /var/log/tomcat/A*.log  forced from command line (5 rotations)
empty log files are not rotated, log files >= 1073741824 are rotated earlier, old logs are removed
No logs found. Rotation not needed.

How come that it does not detect any log file in that directory above 1GB in size?

Maciej Cygan
  • 137
  • 8

0 Answers0