Workaround for Kiwi Syslog file rotation disabled in free version.

Kiwi Syslog is a great little syslogger. However it is quite expensive for those just wanting to log a single firewall.

The rotate logs feature is really handy, as it allows you to make multiple logs and delete old ones, rather than just letting a single log file grow to unmanageable proportions and fill up your C drive.

Unfortunately the rotate logs feature (along with a few other features) is only available in the registered version. However with a little batch file we can easily work around this problem, and use the free version.

This batch file assumes we are using the directory E:syslog to store our syslog, and that the syslog created by Kiwi is called ‘daily.txt’

Create the batch file below in another directory outside of the syslog directory (anything over certain age within the directory will be deleted)

——

cd E:syslog

@Echo Off
 @For /F “tokens=1,2,3 delims=/ ” %%A in (‘Date /t’) do @(
 Set Day=%%A
 Set Month=%%B
 Set Year=%%C
 Set All=%%C%%B%%A
 )
 @For %%a in (“e:syslogdaily.txt”) do copy %%a “%%~na_%All%.txt”

del daily.txt

FORFILES /P e:syslog /D -30 /C “cmd /c DEL @file”

——

Schedule it to run just a little before midnight every night.
This will copy the ‘daily.txt’ file to a file named (eg) daily20130503.txt and delete the original file – which will be recreated by Kiwi.
Forfiles will then delete log files older than 30 days. (you can change that value in the -D switch).

So we get basic file rotation and deletion for free. No asking the accounts people or client for £200. Happy days.

thanks to http://www.zorbathegeek.com for the rename batch file.

Leave a Reply

Your email address will not be published. Required fields are marked *