Cloud customer?
Start for Free >
Upgrade in MyJFrog >
What's New in Cloud >

Search





Since Tomcat is outside the control of Artifactory, you must manually set up log rotation for the Tomcat logs to manage log files.

The following example shows how to set up log rotation for the catalina.out log in a Linux system.

  1. Create a configuration file, tomcat, in the following location: /etc/logrotate.d
  2. Enter the following into /etc/logrotate.d/tomcat.

    /{PATH_TO_CATALINA_FILE}/catalina*.* {
    copytruncate
    daily
    rotate 7
    compress
    missingok
    size 100M
    }

    The following table describes the parameters in the file.

    ParameterDescription
    copytruncateTruncates the original log file in place after creating a copy instead of moving the old log file and creating a new one.
    dailyRotate the log every day.
    rotateThe number of rotation logs to keep.
    compressCompress the log file.
    missingokIf a log file is missing, skip to the next file without throwing an error message.
    size #MMaximum size of the file in megabytes.
  3. Add a cron task to run log rotation automatically. For example, add the task in /etc/cron.hourly/ to run rotation on an hourly basis.

    You can also run the task manually by running /usr/sbin/logrotate /etc/logrotate.conf.


There is a very small time slice between copying the file and truncating it. Therefore, some logging data might be lost

  • No labels
Copyright © 2021 JFrog Ltd.