Pivotal Knowledge Base

Follow

Setting up log rotation for vFabric Enterprise Ready Server httpsd instances (1038369)

Setting up log rotation for vFabric Enterprise Ready Server httpsd instances (1038369)

Purpose

This article describes a method for configuring log rotation for vFabric Enterprise Ready Server (ERS) Web server instances. You may want to configure log rotation to ensure that the logs do not grow indefinitely in size and also to archive old logs without having to restart the server.

Resolution

You can implement log rotation by specifying a location for the log that is a pipe to a log rotation program. To accomplish this, ERS provides rotatelogs in the bin/ sub-directory of the versioned apache directory. You can also use other similar programs for this purpose.

For example, consider ERS is installed under Linux in /home/ers/ and you have an apache2.2 instance in /home/ers/servers/example2.2/. To rotate the error log daily: 
  1. Open the conf/httpsd.conf file using a text editor.
  2. Comment this existing ErrorLog entry:

    #ErrorLog logs/error.log

  3. Add this new entry for daily log rotation:

    ErrorLog "|/home/ers/apache2.2/bin/rotatelogs  /home/ers/servers/example2.2/logs/error.log.%y%m%d 86400"

    Where 86400  indicates the number of seconds in a day.
The same syntax works in Windows. However, the directories are slightly different. For example, consider ERS is installed in C:\ERS and you have an apache2.2 instance in C:\ERS\servers\example2.2. To rotate the access log: 
  1. Open the conf/httpsd.conf file using a text editor.
  2. Comment this entry:

    #CustomLog logs/access.log common

  3. Add this new entry to rotate the log when its size reaches 100MB:

    CustomLog "|C:/ERS/apache2.2/bin/rotatelogs C:/ERS/servers/example2.2/logs/access.log.%y%m%d-%H%M 100M" common

Note: Use the forward-slash file separator in both Linux and Windows. Do not use file paths with spaces or special characters. In Windows, you may be able workaround this issue by using truncated names. For example, you can specify C:/Progra~1 instead of C:/Program Files.

Additional Information

©VMware 2013

Comments

Powered by Zendesk