There is an extensive log maintenance "kit" here: http://www.kixtart.org/ubbthreads/showflat.php?Cat=&Number=75703&page=&view=&sb=5&o=&vc=1

However, I think that this is a bit more fully featured than you need.

Here is a simple example of how you could do the size limit thing in KiXtart:
Code:
Function udfRotateLog($sPath,$iSize,Optional $iGenerations,Optional $bInitLog)


Dim $sMask,$i,$fd

If Not CInt($iGenerations) $iGenerations=1 EndIf
If Not CInt($bInitLog) $bInitLog=0 EndIf
$iSize=CDBL($iSize)

While Len($sMask)<Len($iGenerations) $sMask=CSTR($sMask)+"0" Loop

If GetFileSize($sPath)>=$iSize
; Sanity check - Ignore
; 1 Read Only
; 4 System
; 16 Direcroty
; 256 Temporary
; 4096 Offline
If (1+4+16+256+4096) & GetFileAttr($sPath) Exit 1 EndIf
If @ERROR Exit @ERROR EndIf
; Remove oldest generation
Del $sPath+"."+$iGenerations
; Rotate existing log files
For $i=$iGenerations To 2 Step -1
Move $sPath+"."+Right($sMask+($i-1),Len($iGenerations)) $sPath+"."+Right($sMask+$i,Len($iGenerations))
; Ignore "file not found"
If Not(@ERROR=0 OR @ERROR=2) Exit @ERROR EndIf
Next
; Now move primary log file
Move $sPath $sPath+"."+Right($sMask+1,Len($iGenerations))
If @ERROR Exit @ERROR EndIf
; Finally, create an empty log file if needed
If $bInitLog
$fd=FreeFileHandle()
If @ERROR Exit @ERROR EndIf
If Open($fd,$sPath,1+4) Exit @ERROR EndIf
$=Close($fd)
EndIf
EndIf
Exit 0
EndFunction



Parameters are:
  • $sPath - Path to your log file.
  • $iSize - When file reaches this size (in bytes) it is rotated. If you set this to zero, the file is always rotated.
  • $iGenerations - How many generations of the file to keep
  • $bInitLog - Set to true if you want to create an empty file once the log file has been rotated.


So to keep 50 MB of history, and create an empty file after the rotation:
Code:
$sLogFile="c:\foo\mylogfile.txt"

$iMaxSize=10*1024*1024 ; 10 Megabytes
$iMaxHistory=5

udfRotateLog($sLogFile,$sMaxSize,$iMaxHistory,1)