Spam Filter ISP Support Forum

  New Posts New Posts RSS Feed - Breaking logs into smaller chunks
  FAQ FAQ  Forum Search   Register Register  Login Login

Breaking logs into smaller chunks

 Post Reply Post Reply
Author
Desperado View Drop Down
Senior Member
Senior Member
Avatar

Joined: 27 January 2005
Location: United States
Status: Offline
Points: 1143
Post Options Post Options   Thanks (0) Thanks(0)   Quote Desperado Quote  Post ReplyReply Direct Link To This Post Topic: Breaking logs into smaller chunks
    Posted: 08 October 2004 at 1:13pm

All,

Someone, a long time ago, mentioned a problem dealing with the large log files.  I use a Perl script to "Archive" the log file at noon using the windows scheduler so that I end up with 2 logs / 24 hour period.  It is super simple and makes no "open file" checks so it could fail to archive if SpamFilter is writing to the file at that moment.  However, after 3 months of running, this has never happened.

NO TECH SUPPORT on this script!  Too simple!

Regards,

Dan S.

#SpamFilter Log File Archicing For WIN NT
#Aug. 6 2004 Dan Seligmann, Mags Net LLC

#Get the Current Date
&get_date();

#Archive The Log File
$Path = "d:\\SpamFilterISP\\logfiles";
$FullName = "$Path\\$ActiveFile";

system("rename $FullName $NewFile");

#This function gets the date and time then formats it correctly
sub get_date {

    # Define arrays for the day of the week and month of the year.           #
   
    @days   = ('Sunday','Monday','Tuesday','Wednesday',
               'Thursday','Friday','Saturday');
    @months = ('January','February','March','April','May','June','July',
         'August','September','October','November','December');

    # Get the current time and format the hour, minutes and seconds.  Add    #
    # 1900 to the year to get the full 4 digit year.                         #
    ($sec,$min,$hour,$mday,$mon,$year,$wday) = (localtime(time))[0,1,2,3,4,5,6];
    $time = sprintf("%02d-%02d-%02d",$hour,$min,$sec);
    $year += 1900;
    $dom = sprintf("%02d",$mday);

    # Format the date.

    $mon++;

    $Suf = "a";
    $date = "$mon-$mday-$year-$time";
    $ActiveFile = "$year$mon$dom.log";
    $NewFile = "$year$mon$dom$Suf.log";
}

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down



This page was generated in 0.102 seconds.