Deploying and Managing Apama Applications > Event Correlator Utilities Reference > Shutting down and managing components > Rotating the correlator log file
Rotating the correlator log file
Rotating the correlator log file refers to closing the log file of a running correlator and opening a new log file. This lets you archive log files and avoid log files that are too large to easily view.
Each site should decide on and implement its own correlator log rotation policy. You should consider
*How often to rotate log files
*How large a correlator log file can be
*What correlator log file naming conventions to use to organize log files.
There is a lot of useful header information in the log file being used when the correlator starts. If you need to provide log files to Apama technical support, you should be able to provide the log file that was in use when the correlator started, as well as any other log files that were in use before and when a problem occurred.
On Windows, to automate log file rotation, you can set up scheduled tasks that run the following utilities:
*The following command instructs the correlator to close the log file it is using and start using a log file that has the name you specify. Be sure to enclose the argument after -r in quotation marks.
engine_management -r "setLogFile new-log-filename"
Execution of the setLogFile request is the only way to rotate the correlator log on Windows. This is because Windows does not let you rename a file that is in use. Consequently, each time you rotate the correlator log on Windows you must give the log file a new name.
*The following command instructs the correlator to use the specified file as the log file for the specified node, which can be a package, monitor, or event. See also Setting logging attributes for packages, monitors and events.
engine_management -r "setApplicationLogFile log_filename [node]"
If you do use separate log files for particular packages, monitors, or events you might want to rotate those logs at the same time that you rotate the correlator log. This keeps your Apama log files in sync with each other.
On UNIX, to automate log file rotation, you can write a cron job that periodically does any of the following:
*Set correlator log file name
engine_management -r "setLogFile new_log_filename"
*Set application log file name
engine_management -r "setApplicationLogFile log_filename [node]"
*Reopen the log file
engine_management -r "reopenLog"
Move the correlator log file before execution of the reopenLog request. When you move the correlator log file and then request the correlator to reopen its log file the correlator creates a new log file with the same name. For example, suppose you move correlator_current.log to correlator_archive_2014_10_31.log and then send a reopenLog request. The correlator creates correlator_current.log, opens it, and begins sending any log messages to it. Be sure to enclose the argument after -r in quotation marks.
The reopenLog request applies to any application logs you set up as well as the correlator log. Consequently, you want to move all of these log files before you issue the reopenLog request.
*Send a SIGHUP signal
You can write a cron job that sends a SIGHUP signal to Apama processes. The standard UNIX SIGHUP mechanism causes Apama processes to re-open their log files.
The cron job should first rename log files. Since UNIX allows you to rename a file that is in use, the Apama processes will log to the renamed log files until the cron job sends a SIGHUP to all Apama processes. The SIGHUP signal makes the processes re-open their log files and so they open files that have the old names and begin using them. Of course, these files are initially empty because Apama must re-create them.
Sending a SIGHUP signal does the same thing as the reopenLog request, and like the reopenLog request, sending a SIGHUP signal applies to all Apama log files.
If you instruct the correlator to open a named log file and the correlator cannot open that log file or cannot write to that log file, the correlator sends log messages to stderr but does not generate an error.
Apama does not support automatic log file rotation based on time of day or log file size.
Copyright © Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or its Subsidiaries and or/its Affiliates and/or their licensors.
Use, reproduction, transfer, publication or disclosure is prohibited except as specifically provided for in your License Agreement with Software AG.