KB Article #45189
Windows and Unix Only - How to save the CFT logs over several days
Available on CFT all versions for Windows and Unix Plateform :
With the script delivered with the product, only 3 days will be saved without stopping the monitor
Resolution
We suggest an sample script which will saves for 1 month, the logs contents in the archival file under the log directory.
Replace the contents of the current script indicated in the EXEC parameter on CFTLOG with the following one:
CFT Windows script :
REM ** Sample script which saves the logs on 1 month *
REM ** in the archival file named "CFT_MM-AAAA.LOG" located on C:\CFT232\LOG *
REM *************************************************************************************************
SET DIRLOG=D:\CFT232\LOG
SET YEAR=&1.4SYSDATE
SET MONTH=&5.2SYSDATE
SET NAMELOG=%DIRLOG%\CFT_%MONTH%-%YEAR%.LOG
REM ** Create a new archive file if not exist **
IF NOT EXIST %NAMELOG% (
ECHO ******************************************** > %NAMELOG%
ECHO CFT LOG for %MONTH%/%YEAR% >> %NAMELOG%
ECHO ******************************************** >> %NAMELOG% )
COPY /B %NAMELOG% + &FLOG %NAMELOG%
DEL &FLOG
CFTUTIL CFTFILE TYPE=LOG,FNAME=&FLOG
CFT Unix script :
#!/usr/bin/ksh
# Sample script which saves the logs on 1 month
# in the archival file named "CFT_MM-AAAA.LOG" located on C:\CFT232\LOG
#**********************************************************************************************
filename=`cft2unix &flog`
year=&1.4SYSDATE
month=&5.2SYSDATE
logname=$CFTDIRLOG/cft_$month-$year.log
# Create a new archive file if not exist
if [ ! -e $logname ]
then
echo "************************************************************" > $logname
echo "* CFT LOG for $month/$year *" >> $logname
echo "************************************************************" >> $logname
fi
cat $filename >> $logname
rm -f $filename
CFTUTIL cftfile type=log, fname=$filename
rm $0