Configuring log history features

To enable or change the log history features, look for the LogHistory lines in the siteinfo file. To make changes from the default, you must manually edit these options:

  • LogHistoryEnabled=0

    This number identifies whether the LogHistory feature is enabled for this site. This setting applies to the engine and MonitorD logs in this site.

    • 0 indicates the log history feature is disabled. This is the default.
    • 1 indicates the log history feature is enabled.
  • LogHistoryMaxLogFiles=0

    This number identifies the maximum number of backed up log files that are kept if LogHistoryEnabled=1 (enabled). This setting applies to the engine and MonitorD logs.

    • 0, or a negative value, indicates the maximum number is unlimited. 0 is the default.
    • x indicates the maximum number. This is a positive value.
  • LogHistoryMaxDiskUse=0

    This number identifies the maximum size, in bytes, of the total backed up log files that are kept if LogHistoryEnabled=1. This setting applies to the engine and MonitorD logs.

    • 0, or a negative value, indicates the maximum number is unlimited. 0 is the default.
    • x indicates the maximum number. This is a positive value.
  • LogHistoryCompressCommand=NULL

    This string value identifies the command to compress the backed up log files to save the disk space. The value of this option is the binary name to compress the backed up log files. The default value is NULL (compression is disabled).

LogHistory directory

When log history is enabled, a LogHistory directory in the corresponding process or hcimonitord directory is created to store all the backed up logs.

hciengine creates the directory $HCISITEDIR/exec/processes/process name/logHistory.

hcimonitord creates the directory $HCISITEDIR/exec/hcimonitord/logHistory.

How multiple log files are labeled

When log history is disabled (LogHistoryEnabled=0), a copy is kept of the last engine log file by appending an .old extension to the file name.

Only one log file is kept. After the engine is restarted, the .old log file is overwritten.

When the log history feature is enabled (LogHistoryEnabled=1), multiple log files can be retained.

Using hciengine as an example, when log history is enabled, after you start the engine, the engine checks if a .log.old file exists.

  • If one exists, then the engine renames the .log.old log file to processname timestamp.log and moves it to the process name/logHistory directory.
  • If one does not exist, then the engine checks if a .log file exists. If one does not exist, then it goes on without log history.

    If one does exist, then it renames the .log log file to processname timestamp.log and moves it to the process name/logHistory directory.

    After being moved, the backed up log file is compressed to save disk space when LogHistoryCompressCommand is enabled. Then, a new .log file is created.

Log history checking and clean-up

When the engine is started, log history checking is triggered. At that time, the number and total size of backed up log files are checked against LogHistoryMaxLogfiles and LogHistoryMaxDiskUse. These are defined in the siteInfo file.

  • If the backed up logs file size is greater than LogHistoryMaxDiskUse, then the oldest backed up log file is deleted until the condition fails.
  • If the actual number of backed up logs is greater than LogHistoryMaxLogfiles, then the oldest backed up log file is deleted until the condition fails.

When engine is recycled, the log history checking follows the same process.

The effective value of LogHistoryMaxLogfiles and LogHistoryMaxDiskUse is the value in the siteInfo file when engine was started. There is no effect if the value is changed after the engine is started.

Log file timestamp

When generating the log file, hciengine supplies a time stamp for every record in the log file. The format of time stamp is month/day/year hours: mins: secs.