HOWTO: Control application.log file size and backups

A customer recently asked: How can I control the size and number of backups of my /var/log/cloudbolt/application.log file?

By default the logging configuration is set in settings.py. Since this file gets overwritten with each update, we want to override this configuration in /var/opt/cloudbolt/proserv/customer_settings.py -- a file that is preserved across CloudBolt updates.

To override the default logging settings for the application.log file and jobengine.log you can add the following to your customer_settings.py file:

from settings import LOGGING
LOGGING['handlers']['logfile']['maxBytes'] = 2^20 * 10            # 10 Megabytes
LOGGING['handlers']['logfile']['backupCount'] = 10                # Maintain 10 backups

LOGGING['handlers']['jobengine_logfile']['maxBytes'] = 2^20 * 10  # 10 Megabytes
LOGGING['handlers']['jobengine_logfile']['backupCount'] = 10      # Maintain 10 backups

This bumps the max size for each log from 5MB to 10MB and retains 10 backups. You can adjust the size and number of backups to suit your environment.

 

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.