This article describes how to use LogRotate to limit the size of the OpenSplice log files. This will ensure that the files do not grow too large.
The Vortex OpenSplice middleware can produce a number of different trace and log files which allow you to find out what is going on in the system. The exact log files produced depend on the applied configuration settings. Logging in Vortex OpenSplice provides a complete overview of the different configuration settings and log files.
Having log files is useful as it helps to track usage or troubleshoot an application. As more information gets logged the log and trace files can grow quite large, especially if you are using a verbose log level. This can lead to resource problems such as running out of disk space. It is a good idea to keep files down to manageable size and remove the old log files. To do this you can use LogRotate to limit the size of OpenSplice log files.
If you are using Vortex OpenSplice V6.9.2p1 or above you can use LogRotate to help manage the size of the log files.
How to use LogRotate to limit the size of OpenSplice log files
What is LogRotate?
LogRotate is an OpenSource utility that can be run to handle automatic rotation, compression, removal and mailing of log files. It is a command line utility that can be scheduled to run at a specific time or just when you need to invoke it. On linux you can run LogRotate as a daily cron job. On windows you can set up a scheduled task.
How do I install LogRotate
LogRotate is usually installed on Linux systems by default. You can check if it is installed by using the command
If it is not installed you can find the download and the details for installation on the LogRotate github page
On Windows you need to use LogRotateWin. This can be downloaded from the SourceForge page
The download is provided as a Setup file which you can double click to install.
How do I use LogRotate
LogRotate is run using the command line. This tells it where to find the configuration files which determine where it finds the log files it needs to rotate, how often the files should be rotated and how many archived logs to keep. Any number of config files may be given on the command line. Later config files may override the options given in earlier files, so the order in which the logrotate config files are listed is important.
If no command line arguments are given, logrotate will print version and copyright information, along with a short usage summary.
The command line arguments vary slightly between the linux and windows versions of LogRotate so it is best to look in the LogRotate manual for examples of usage.
Where do I find the LogRotate manual?
The LogRotate Configuration File
A log file and its rotation behaviour are defined by listing the log file (or files) followed by a set of commands enclosed in curly brackets. Most application configuration files will contain just one of these blocks, but it’s possible to put more than one in a file, or to add log file blocks to the main
You can find examples of different configuration files you can use in the LogRotate manuals.
For Vortex OpenSplice the following example config_file arguments are advised for logrotate:
# sample logrotate configuration file
# The copytruncate option specifies that logfiles are first copied and
# then truncate. This option is required for OpenSplice instead of using
# the create option to avoid closing the file descriptors used by
# The compress option is used to compress the logfile copies.
# The following options specify that the log files in the current directory
# will be rotates when the file size exceeds 100k and that at most the 5
# most recent rotated files are maintained.