Logrotate exécute post-repository même si le file n'est pas tourné

J'ai un problème avec mon rsyslog et imfile qui échoue quand un de mes files journaux est tronqué.

Donc, pour contourner le problème, j'ai modifié le script logrotate comme suit:

"/etc/logrotate.d/logrotate.elasticbeanstalk.tomcat7.conf": mode: "000644" owner: root group: root content: | /var/log/tomcat7/* { size 1M rotate 5 missingok compress notifempty copytruncate dateext dateformat %s olddir /var/log/tomcat7/rotated postrotate (/sbin/service rsyslog stop && rm -f /var/lib/rsyslog/tomcat-catalina && /sbin/service rsyslog start 2>&1) || true endscript } 

Dans le dossier tomcat7 il y a plus ou less 15 files, ils sont TOUS less que 1M s'attendre à catalina.out Donc, je m'attends à logrotate pour SEULEMENT exécuter le script post-repository lors du traitement de ce file, mais ici, il est ce qu'il fait:

 [ec2-user@ixxxxxxx]$ sudo logrotate -v /etc/logrotate.d/logrotate.elasticbeanstalk.tomcat7.conf reading config file /etc/logrotate.d/logrotate.elasticbeanstalk.tomcat7.conf reading config info for /var/log/tomcat7/* olddir is now /var/log/tomcat7/rotated Handling 1 logs rotating pattern: /var/log/tomcat7/* 1048576 bytes (5 rotations) olddir is /var/log/tomcat7/rotated, empty log files are not rotated, old logs are removed considering log /var/log/tomcat7/catalina.2015-03-11.log log does not need rotating considering log /var/log/tomcat7/catalina.2015-03-12.log log does not need rotating considering log /var/log/tomcat7/catalina.2015-03-13.log log does not need rotating considering log /var/log/tomcat7/catalina.2015-03-14.log log does not need rotating considering log /var/log/tomcat7/catalina.2015-03-16.log log does not need rotating considering log /var/log/tomcat7/catalina.2015-03-17.log log does not need rotating considering log /var/log/tomcat7/catalina.2015-03-18.log log does not need rotating considering log /var/log/tomcat7/catalina.out log needs rotating considering log /var/log/tomcat7/host-manager.2015-03-11.log log does not need rotating considering log /var/log/tomcat7/host-manager.2015-03-12.log log does not need rotating considering log /var/log/tomcat7/host-manager.2015-03-13.log log does not need rotating considering log /var/log/tomcat7/host-manager.2015-03-14.log log does not need rotating considering log /var/log/tomcat7/host-manager.2015-03-16.log log does not need rotating considering log /var/log/tomcat7/host-manager.2015-03-17.log log does not need rotating considering log /var/log/tomcat7/host-manager.2015-03-18.log log does not need rotating considering log /var/log/tomcat7/localhost.2015-03-11.log log does not need rotating considering log /var/log/tomcat7/localhost.2015-03-12.log log does not need rotating considering log /var/log/tomcat7/localhost.2015-03-13.log log does not need rotating considering log /var/log/tomcat7/localhost.2015-03-14.log log does not need rotating considering log /var/log/tomcat7/localhost.2015-03-16.log log does not need rotating considering log /var/log/tomcat7/localhost.2015-03-17.log log does not need rotating considering log /var/log/tomcat7/localhost.2015-03-18.log log does not need rotating considering log /var/log/tomcat7/localhost_access_log.txt log does not need rotating considering log /var/log/tomcat7/manager.2015-03-11.log log does not need rotating considering log /var/log/tomcat7/manager.2015-03-12.log log does not need rotating considering log /var/log/tomcat7/manager.2015-03-13.log log does not need rotating considering log /var/log/tomcat7/manager.2015-03-14.log log does not need rotating considering log /var/log/tomcat7/manager.2015-03-16.log log does not need rotating considering log /var/log/tomcat7/manager.2015-03-17.log log does not need rotating considering log /var/log/tomcat7/manager.2015-03-18.log log does not need rotating considering log /var/log/tomcat7/tomcat7-initd.log log does not need rotating running postrotate script Shutting down system logger: [ OK ] Starting system logger: [ OK ] running postrotate script Shutting down system logger: [ OK ] Starting system logger: [ OK ] running postrotate script Shutting down system logger: [ OK ] Starting system logger: [ OK ] running postrotate script Shutting down system logger: [ OK ] Starting system logger: [ OK ] running postrotate script Shutting down system logger: [ OK ] Starting system logger: [ OK ] running postrotate script Shutting down system logger: [ OK ] Starting system logger: [ OK ] running postrotate script Shutting down system logger: [ OK ] Starting system logger: [ OK ] rotating log /var/log/tomcat7/catalina.out, log->rotateCount is 5 Converted ' %s' -> '%s' dateext suffix '1426682650' glob pattern '[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]' copying /var/log/tomcat7/catalina.out to /var/log/tomcat7/rotated/catalina.out1426682650 truncating /var/log/tomcat7/catalina.out running postrotate script Shutting down system logger: [ OK ] Starting system logger: [ OK ] compressing log with: /bin/gzip removing old log /var/log/tomcat7/rotated/catalina.out1426648681.gz running postrotate script Shutting down system logger: [ OK ] Starting system logger: [ OK ] running postrotate script Shutting down system logger: [ OK ] Starting system logger: [ OK ] running postrotate script Shutting down system logger: [ OK ] Starting system logger: [ OK ] running postrotate script Shutting down system logger: [ OK ] Starting system logger: [ OK ] running postrotate script Shutting down system logger: [ OK ] Starting system logger: [ OK ] running postrotate script Shutting down system logger: [ OK ] Starting system logger: [ OK ] running postrotate script Shutting down system logger: [ OK ] Starting system logger: [ OK ] running postrotate script Shutting down system logger: [ OK ] Starting system logger: [ OK ] running postrotate script Shutting down system logger: [ OK ] Starting system logger: [ OK ] running postrotate script Shutting down system logger: [ OK ] Starting system logger: [ OK ] running postrotate script Shutting down system logger: [ OK ] Starting system logger: [ OK ] running postrotate script Shutting down system logger: [ OK ] Starting system logger: [ OK ] running postrotate script Shutting down system logger: [ OK ] Starting system logger: [ OK ] running postrotate script Shutting down system logger: [ OK ] Starting system logger: [ OK ] running postrotate script Shutting down system logger: [ OK ] Starting system logger: [ OK ] running postrotate script Shutting down system logger: [ OK ] Starting system logger: [ OK ] running postrotate script Shutting down system logger: [ OK ] Starting system logger: [ OK ] running postrotate script Shutting down system logger: [ OK ] Starting system logger: [ OK ] running postrotate script Shutting down system logger: [ OK ] Starting system logger: [ OK ] running postrotate script Shutting down system logger: [ OK ] Starting system logger: [ OK ] running postrotate script Shutting down system logger: [ OK ] Starting system logger: [ OK ] running postrotate script Shutting down system logger: [ OK ] Starting system logger: [ OK ] 

Comment puis-je éviter que cela ne se produise? Je ne suis pas un expert avec les choses unix, mais je suppose que, à partir de 100 fois, un service comme celui-ci n'est pas très bon?

Pour exécuter le script post-repository une seule fois (lors de la définition d'une input logrotate sur plusieurs files), ajoutez l'option sharedscripts