Log rotation of log files

This information is important in order to keep your server in good situation by avoiding the size of several log files to be increasing day by day. It will be used the well known linux utility logrotate. You can see details here. After configuring the logrotate in your server the log files will stop increasing and your server will be in good health according to this issue.

Step-by-step guide

  1. Check that logrotate utility is installed in your system
  2. Create a configuration file for managing the log files produces by openncp servers (see below)

Sample Configuration File

(Adjust the paths to fit your environment)
 
/opt/tomcat-portal/tomcat-7.0.42/logs/catalina.out {
copytruncate
daily
rotate 7
compress
missingok
size 50M
}
/opt/tomcat-portal/tomcat-7.0.42/logs/epsos-client-connector.log {
copytruncate
daily
rotate 7
compress
missingok
size 50M
}
...
...

Configuration Parameters

Make sure that the path /opt/tomcat-portal/tomcat-7.0.42/logs/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 50M

You can put multiple entries in the previous file in order to include several log files for rotation

Test Rotation Performance

sudo logrotate --force /etc/logrotate.d/openncp  (openncp is the name of logrotate configuration file)