Print Page | Close Window

Breaking logs into smaller chunks

Printed From: LogSat Software
Category: Spam Filter ISP
Forum Name: Spam Filter ISP Support
Forum Description: General support for Spam Filter ISP
Printed Date: 17 October 2017 at 2:45pm

Topic: Breaking logs into smaller chunks
Posted By: Desperado
Subject: Breaking logs into smaller chunks
Date Posted: 08 October 2004 at 1:13pm


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!


Dan S.

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

#Get the Current 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',
    @months = ('January','February','March','April','May','June','July',

    # 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.


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

Print Page | Close Window