Tag Archives: Windows Server 2008 R2

Log file zipper – Part 2

Its been almost a year since my first post on this subject.  Over the past year I have moved from hosting all of my websites with Server 2003 to Server 2008, and in the course of that I had to re-setup my log zipping application.

In the course of that, I found that the previous script did not work with IIS7 logfiles.  The difference being the default naming convention of the files.  In IIS 6 the name was exYYMMDD.log, in IIS7 the name is u_exYYYYMMDD.log.  that extra u_ was throwing off the script as it tried to parse the date out to create the zip file.  So I got back in touch with my buddy who originally wrote the script and requested some features.

What we came up with is a script that determines the offset of the date in the filename and can parse the date regardless of the convention.   This will allow you to run it against IIS6 or IIS7 logs without modification.  (In theory you could use this against any type of log file that includes a date, but I have not tested it)

We also threw in a variable that allows the user to set how many days of logfiles to keep on the drive unzipped.  In this fashion you can keep the most recent X days of logs uncompressed for troubleshooting.

I also included a batch file that will allow you to run, and/or schedule a task to run the script as needed.  The files are located here.  Give it a shot and let me know if it helps!

 

Windows Server 2008 Task Error 0x1

I’ve been working with Windows Sever 2008 and 2008 R2 only for a couple of months now.  Generally the OS is greatly improved over 2003.  There are many quirks that are frustrating though.  They are generally little things, but there is nearly zero documentation and only extensive web searches reveal the fix.

One issue I’ve been struggling with is the Task Scheduler not working on what I had assumed were basic tasks.  I have a script that I run to clean out files of a certain age from a specified folder.  I use it for deleting log files and some backups etc.  The task simply executes a batch file which calls a .vbs script.  The task was failing with error code 0x1 without any farther details.  After some time spent searching and trying different things I found the trick that worked.

When running a batch file at least, it seems that when setting up a task you cannot just specify the file to be run, you also have to specify the ‘start in’ parameter.  For example if you specify c:\temp\script.bat you also have to specify c:\temp as the start in parameter.  I did this and my task is now working like a charm!