THis will rotate daily (and add a date ext to the old file), after 31 days it will start to delete old files. It will not compres them (remove this line if you want it to compress the old log files). Not the size attribute is no longer been specified as it overrides the daily directive, and only rotates if files grow greater than10M. (Apparently there is a maxSize directive in newer versions of logrotate, that can be combined).. See http://serverfault.com/questions/391538/logrotate-daily-and-size
This job gets run nightly. If you want to run it immediately (e.g. to rotate a large file) then,
>sudo /usr/sbin/logrotate /etc/logrotate.conf
e.g. > sudo vi /etc/logrotate.d/tomcat
/dirto/catalina.out /dirto/tomcat.log /dirto/admin.log /dirto/stacktrace.log{ copytruncate daily rotate 31 nocompress dateext missingoksize 10M}
No comments:
Post a Comment