5

How to rotate your Tomcat catalina.out log file

In Incorta Analytics, Version 4.x, both the analytics service and the loader service rely on Tomcat to drive the service.  Tomcat's primary log file is called catalina.out.  With a lot of load activity and end user activity, this catalina.out file can grow to be very large for both services.  As with many Java applications, you can rotate these logs periodically to keep any single file from growing too large.  

To setup log file rotation for your catalina.out files after they grow larger than 1024MB, use the following procedure: 

Note: you will need administrative privileges on your linux server to conduct these steps.

1. Create a file called tomcat:

/etc/logrotate.d/tomcat

2. Copy the following contents into this tomcat file:

/home/incorta/IncortaAnalytics/IncortaNode/services/<GUID of your service>/logs/catalina.out {
  copytruncate
  daily
  rotate 7
  compress
  missingok
  size 1024M
}

Make sure that the path /home/incorta/IncortaAnalytics/IncortaNode/services/<GUID of your service>/logs/catalina.out above is adjusted to point to your installation's specific Tomcat catalina.out file.

Here's what each component in the file means:

  • daily - rotates the catalina.out daily
  • rotate – keeps up to 7 log files
  • compress – compresses the rotated files
  • size – rotates if the size of catalina.out is bigger than 1024MB

That's it. You don't need to restart.

1reply Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
  • You may need to update the tomcat file as below to run it as incorta user

    /home/incorta/IncortaAnalytics/IncortaNode/services/3490d4ab-b661-4a22-b502-c60e766fe28b/logs/catalina.out {
      create 0640 incorta incorta
      copytruncate
      daily
      rotate 7
      compress
      missingok
      size 1024M
      su incorta incorta
    }
    
    


    Execute a dry-run to see what logrotate would do if it was actually executed now. Use the -d option followed by the configuration file (you can actually run logrotate by omitting this option)

    sudo logrotate -d /etc/logrotate.d/tomcat
    Like
Like5 Follow
  • 5 Likes
  • 2 wk agoLast active
  • 1Replies
  • 705Views
  • 3 Following