Configuring Agent Log Rotation

2 minute read

CloudBees Build Acceleration automatically rotates session logs using default settings. The session log naming conventions and rotation behaviors are as follows:

  • stdout or stderr logs go to consoleN.log (where N is the agent number).

  • Normal session trace messages go to ecagentN.log (where N is the agent number).

  • Only session trace logs will be rotated.

  • The default size limit for log files before being rotated is 1 GB.

  • The default number of rotated files to keep is 20. When that limit is reached, the oldest log files will begin to be deleted to make space for newer logs.

  • The most recent log messages are in ecagentN.log. When the log file reaches its size limit, that file is renamed to ecagentN.log.1. If ecagentN.log.1 already exists, then it is renamed to ecagentN.log.2 before ecagentN.log is renamed to ecagentN.log.1. If ecagentN.log.2 exists, it is first renamed to ecagentN.log.3 and so on. This rotation continues until the retain count is met, at which point file deletion begins.

To configure agent log rotation, you edit the runagent.local file:

  1. Navigate to the <ECloud install>\<arch>\bin directory.

  2. Open the runagent.local file. If this file does not already exist, you must create it. This file uses Tcl script syntax.

  3. Add the desired options using this format: session logger <option>

For example: session logger retaincount 10

Available log rotation options:

Option Description

maxfilesize <bytes>

Get or set the maximum file size for log files before they are rotated. The default is 1 GB.

filename <path>

Get or set the file name to log to. The default for UNIX is /var/log/ecagentN.log. The default for Windows is <install dir>\ecagentN.log (for example, C:\ECloud\ecagentN.log ).

retaincount <count>

Get or set the number of rotated log files to retain before starting to delete them. The default is 20. To turn off log rotation, set to 0.

clear

Clear the contents of the ecagent N .log file. This is useful when log rotation is turned off.