Skip to main content

Maintain Logfiles

Overview

The application log files were previously combined into a single log file for the day. This made problem resolution difficult. These files have since been seperated out.

The logs are made up of 4 parts.

  • The XP2 Connector Program that is run
  • The XP2 application that is being ran
  • The start time of the job, formated as YYYYMMDDHHMMSS
  • The PID number for the process.
Example

The log file for 'ccstmt1' that started at 09:32:36 on 02/27/2020 with a PID of 13762792, would look like the following:

run_xp_job-ccstmtl-20200227093236-13762792.log

Command Line

To maintain the logs that are generated by the XP2 Connector, an OpCon job will need to be created to run this script. It is recommended that this job be added to the SMAUtiltiy scheduled and have it run the following command line:

/ops/bin/maintain_logfiles.pl

Command Line Parameters

The script to maintain the logs is simple. You will need to specify the location of the log files and the number of days that you would like to keep in the script.

LOGDIR

This is the path to where the logs are located in the installation path.

DAYS2KEEP

This is the number of days you would like to keep the logs.

Example

Here is what the parameters look like in the maintain_logfiles.pl file.

#!/bin/sh
export LOGDIR=/ops/bin/log
export DAYS2KEEP=3
echo "The following files appear to be too old and will be deleted"
echo "------------------------------------------------------------"
find $LOGDIR -type f -name \*.log -mtime
+$DAYS2KEEP -exec echo {} \; find $LOGDIR -type f -name \*.log -mtime
+$DAYS2KEEP -exec rm -f {} \; echo "Finished"