How to configure log rotation by file size in VMware vRealize Orchestrator 5.x/6.0.x
search cancel

How to configure log rotation by file size in VMware vRealize Orchestrator 5.x/6.0.x

book

Article ID: 342264

calendar_today

Updated On:

Products

VMware Aria Suite

Issue/Introduction

This article provides steps to configure the log rotation in the VMware vRealize Orchestrator (formerly known as vCenter Orchestrator) appliance by file size instead of daily rotation, which is set by default.

Environment

VMware vCenter Orchestrator 5.5.x
VMware vRealize Orchestrator 6.0.x

Resolution

To configure the log rotation in the VMware vRealize Orchestrator Appliance by file size:
  1. Set the maximum log file size for the vRealize Orchestrator logs.
  2. Configure a cron job to run logrotate based on a time interval.
To set the maximum log file size for vRealize Orchestrator logs:
  1. Log in to the VMware vRealize Orchestrator appliance.
  2. Navigate to this location:

    /etc/logrotate.d/

  3. Edit or create the vco.lr file and add the following code:
    Note
    : The code is an example.

    /var/log/vmware/vco/app-server/catalina.out {
    size 5M
    rotate 5
    start 1
    compress
    missingok
    nocreate
    notifempty
    sharedscripts
    copytruncate
    su vco vco
    }
    /var/log/vmware/vco/app-server/localhost_access_log.txt {
    size 5M
    rotate 20
    start 1
    compress
    missingok
    nocreate
    notifempty
    sharedscripts
    copytruncate
    su vco vco
    }
With this configuration logrotate compresses and rotates the logs after reaching the defined size and rotate number limits. After setting the maximum log file size, configure a cron job to run logrotate based on a time interval:
  1. Copy logrotate script to /etc/cron.hourly:

    cp /etc/cron.daily/logrotate /etc/cron.hourly

  2. Edit the file and replace /usr/sbin/logrotate /etc/logrotate.conf 2>&1 | tee $TMPF with /usr/sbin/logrotate /etc/logrotate.d/vco.lr 2>&1 | tee $TMPF
  3. Edit /etc/vco/app-server/server.xml and add the rotatable="false" and checkExists="true" attributes to the Valve tag with a class name className="org.apache.catalina.valves.AccessLogValve" just before closing the tag.
  4. Restart the Orchestrator server.
After you complete the procedure, logrotate checks the log files described in vco.rl hourly for their size and if size is exceeded, it compresses the old file and creates a new one.