Table of Contents
LogRotate Handler
This extension for the default FileHandler can rotate log files like the Linux Logrotate command.
Installation
We provide a VI package (*.vip) to be installed with the JKI VI Package Manager. The commercial package can be downloaded by authorized people on our Log Rotate Handler release page.
Configuration
The Create LogRotate
method takes a cluster LogRotate Configuration
for all specific options.
Cluster LogRotate Configuration
:
-
Rotations: Max number of rotations for the log file. With
n
rotations, there will ben
additional files to the log file. If Rotations is0
, no file with the content of the previous period will be created. -
Max Size (Byte): If the log file size exceeds “Max Size”, the log file will be rotated. If “Max Size” is
0
, the log file will not be rotated by file size. -
Period: The period in which interval the rotation will be executed. Possible intervals are:
-
None
: No rotation by period. -
Instant (for testing)
: The file will be rotated instantly with every log event. This case is intended for testing only. -
hourly
: The log file will be rotated on every full hour. -
daily
: The log file will be rotated on every new day. -
weekly
: The log file will be rotated on every new week. -
monthly
: The log file will be rotated on every new month.
Compression CMD: If provided, use this command to compress the rotated log files with an external program (e.g. 7zip, gzip). If the command contains white spaces, it must be enclosed in quotes. The variable$INPUT
contains the file path of the rotated log file and the variable$OUTPUT
the file path of the compressed output file. Do _not_ enclose these variables in quotes, this is done automatically.$INPUT
is mandatory,$OUTPUT
not, it depends on the program whether you need it. See examples below.Compress Extension: Filename extension for the compressed log files, e.g. “zip”.For versions ⇐ 1.0.2, you have to use the file extension.log
for the log file. Otherwise, it will throw an error after the second log.Initialization
The initialization is the same as for other Log-Handler. Use the method
Create LogRotateFileHandler.vi
to instantiate a new LogRotate-Handler and configure it. Then wire the object together with other Log-Handlers, if applicable, as array to theInit Loggin
method.Compression CMD examples
7-Zip on Windows with zip file format:
“C:\Program Files\7-Zip\7z.exe” a -tzip $OUTPUT $INPUT
GZip on Linux:
gzip “$INPUT”
-