Automatically rotate Tomcat logs

1. Create this file

/etc/logrotate.d/tomcat  

2. Copy the following contents into the above file

/opt/entermediadb/tomcat/logs/catalina.out {  
  copytruncate  
  daily  
  rotate 7  
  compress  
  missingok  
  size 100M  
}  

Options:
daily – rotates the catalina.out daily.
rotate – keeps at most 7 log files.
compress – compresses the rotated files.
size – rotates if the size of catalina.out is bigger than 100M.
copytruncate – truncates the original log file in place after creating a copy, instead of moving the old log file and optionally creating a new one.

Run logrotate manually

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