Skip to content

logrotate

Example - catalina.out

Create and insert

Bash
/etc/logrotate.d/tomcat
Bash
/var/log/tomcat/catalina.out {
copytruncate
daily
rotate 7
compress
missingok
size 2G
}

About the above configuration:

Make sure that the path /var/log/tomcat/catalina.out above is adjusted to point to your tomcat’s catalina.out

daily - rotates the catalina.out daily

rotate – keeps at most 7 log files

compress – compressesthe rotated files

size – rotates if the size of catalina.out is bigger than 5M


Run command manually:

Bash
/usr/sbin/logrotate /etc/logrotate.conf

Stolen from here - click

Back to top