Apama 10.3.1 | Apama Documentation | Deploying and Managing Apama Applications | Correlator Utilities Reference | Starting the correlator | Examples for specifying log filenames
 
Examples for specifying log filenames
This topic provides examples of specifying log filenames. The format for specifying a log filename is the same in the following cases:
*Starting the correlator and specifying a main correlator log file with the --logfile option.
*Starting the correlator and specifying a correlator input log file with the --inputLog option.
*Invoking engine_management --setLogFile to rotate the main correlator log.
*Invoking engine_management --setApplicationLogFile to create an EPL log file for a package, monitor or event.
The following specifies that the name of the main log is "correlator_status.log":
--logfile correlator_status.log
Suppose that the correlator processes events for a while, sends information to correlator_status.log, and then you find that you need to restart the correlator. If you restart the correlator and specify the exact same log filename, the correlator overwrites the first correlator_status.log file. To avoid overwriting a log, specify ${START_TIME} in the log file name specification when you start the correlator. For example:
--logfile correlator_status_${START_TIME}.log
The above command opens a log with a name something like the following:
correlator_status_2015-03-12_15:12:23.log
This ensures that the correlator does not overwrite a log file. Now suppose that you want to be able to rotate the log, so you specify the ${START_TIME} and ${ID} tags:
correlator_status_${START_TIME}_${ID}.log
The initial name of the log file is something like the one on the first line below. If you then rotate the log file then the correlator closes that file and opens a new file with a name like the one on the second line:
correlator_status_2015-03-12_15:12:23_001.log
correlator_status_2015-03-12_15:12:23_002.log
To specify an EPL log filename for messages generated in com.example.mypackge, you can specify the log filename as follows:
mypackage_${ID}_${ROTATION_TIME}.log
With that specification, messages generated in com.example.mypackage will go to a file with a name such as the one on the first line below. The time in the initial EPL log filename is the time that the initial log file is created. If you rotate the logs every 24 hours at midnight then the names of subsequent EPL log files will be something like the names in the second and third lines below.
mypackage_001_2015-03-21_18:42:06.log
mypackage_002_2015-03-22_00:00:00.log
mypackage_003_2015-03-23_00:00:00.log
If you want to run multiple correlators with the same arguments but with separate log files, you can use the process ID to differentiate them:
--logfile correlator_${PID}.log
The above command will produce a log file with a name such as the following, where each correlator will have a unique log file:
correlator_23487.log
UNIX note
In most UNIX shells, when you start a correlator you most likely need to escape the tag symbols, like this:
correlator -l license --inputLog input_\${START_TIME}_\${ID}.log

Copyright © 2013-2019 | 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.