Co-incidentally I had to implement error log rolling today. Here's what I did based on an ACS 3 version I had working written by
mailto:arjun@openforce.net :
In your server's .tcl file put these 2 lines after ns_section ns/parameters:
ns_param logroll on
ns_param maxbackup 30
Then create 2 files in /acs-tcl/tcl, one called logroll-init.tcl and the other called logroll-procs.tcl.
logroll-procs.tcl contains the following:
#
# logroll.tcl - Rolls the server log on a daily basis
#
# mailto:arjun@openforce.net
# May 17, 2001
# version 0.1
#
# Note: This script is for rolling the _server_ log not the _access_ log!
ad_library {
TCL library for the rolling error log.
@creation-date 23/01/2003
}
#
# Directions
# ----------
# 1. Set the MaxBackup ns_param in the "ns/parameters" section of your config
# file to the desired number of backups. NOTE: The AOLServer documentation
# incorrectly calls this param "LogMaxBackup"! You can verify this param is set
# correctly by seeing something like "Notice: conf: [ns/parameters]maxbackup = 6"
# in your server log.
#
#
# Further Work
# ------------
# - Verify the log got rolled, if not send email
# - Check for disk space
# - Allow for non-daily intervals
# - scp logs to a remote site(s)
# You don't have to edit anything below this line
ad_proc -public roll_server_log {
} {
Proc to roll server error log
} {
set MaxBackupValue [ns_config -int "ns/parameters" MaxBackup]
if {$MaxBackupValue == ""} {
# The default is 10
set MaxBackupValue 10
}
ns_log Notice "logroll.tcl: About to roll server log. ns_param MaxBackup = $MaxBackupValue "
ns_logroll
ns_log Notice "logroll.tcl: Just rolled server log"
}
logroll-init.tcl contains the following:
# Adjust the paramaters below. Hours are between 0-23,
# and minutes are between 0-59
set hour 16
set minute 00
ns_log Notice "Scheduling logroll"
# Schedule "roll_server_log" to run at the desired time
ns_schedule_daily $hour $minute roll_server_log
Then just bounce your AOLserver.