Forum OpenACS Q&A: Response to Compressing nslog access log's...

Posted by Michael A. Cleverly on
I imagine you may have already implemented your own proc to roll your access log as Jonathan suggested. On the off chance you haven't or for the benefit of some future searcher, here is a proc that I used to use under AOLserver 2.3 (had it scheduled via ns_schedule_daily to run at 00:00). I don't use it anymore because I finally realized I never looked or did anything with the logs, so why did I need to keep them? 😉

proc roll_access_log {} {
    set today [ns_time]
    set yesterday [expr [ns_time] - 86400]
    set yesterday [ns_fmttime $yesterday "%Y-%m-%d"]
    set log_dir servers/store/modules/nslog

    ns_log notice "Preparing to roll access log..."
    ns_accesslog roll $log_dir/access.log.$yesterday
    exec gzip -9 $log_dir/access.log.$yesterday

    ns_log notice "Access log rolled..."