• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 575
  • Last Modified:

Script to compress log files to .zip archive

I found a VB script that compresses the log files into windows cabinet files, however the format that we need these files to be is .zip to support our WebTrends server - does anyone know of a script that will compress these IIS log files into a .zip archive?

0
jpipitone
Asked:
jpipitone
  • 5
  • 4
1 Solution
 
Kim RyanIT ConsultantCommented:
You can use a Winzip utility from the MS-DOS command line  to create .zip file. This could be wrapped in a DOS batch file.
http://www.winzip.com/prodpagecl.htm
0
 
jpipitoneAuthor Commented:
well we need to grab the log file locations from our IIS configuration, then delete the log files after they are compressed, as this script does:

http://www.iisfaq.com/Default.aspx?tabid=2809

I need .zips created rather than .cab as this script does everything I need it to do with the exception of the archive format.
0
 
Kim RyanIT ConsultantCommented:
You can still use the script you referred to above.  I do not have the time do give you a complete solution, but it should be fairly simple. In brief,  the lines below will need to modified it to invoke winzip rather than makecab.

Command = "makecab " & chr(34) & Filespec & chr(34) & " " & chr(34) & CabFileSpec & chr(34)
 ReturnCode = WshShell.Run(Command, 7, True)

----
And and few lines above, u probably want the file to be end with .zip instead of .cab

CabFilename = left(NewFilename, len(NewFilename)-3) + "cab"
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
jpipitoneAuthor Commented:
OK - when you get time would you be able to tell me how to invoke winzip rather than makecab?
0
 
Kim RyanIT ConsultantCommented:
First you need to check if you have Winzip Pro as only this version has command line support. You can download an evaluation copyu but may have to buy a licence at some stage. I don't have the product with me at the moment, actual name would be in the documentation. But say for example, the utulityi is called winzip

CabFilename = left(NewFilename, len(NewFilename)-3) + "cab"  
changes to
CabFilename = left(NewFilename, len(NewFilename)-3) + "zip"

Command = "makecab " & chr(34) & Filespec & chr(34) & " " & chr(34) & CabFileSpec & chr(34)
changes to
Command = "winzip " & chr(34) & Filespec & chr(34) & " " & chr(34) & CabFileSpec & chr(34)

That is the basic logic, but can't be sure of all the details without being able to run the code myself. Hope this helps.

0
 
jpipitoneAuthor Commented:
Cool I'll try it out and see what I can come up with - I appreciate the help.
0
 
Kim RyanIT ConsultantCommented:
Glad to help, hope this solution works for you.
0
 
jpipitoneAuthor Commented:
I've installed WinZip and the command line add on and it throws this error:

ArchiveOldWebSiteLogfiles.vbs(100,4) Microsoft VBScript runtime error: Type mismatch: 'cint'

Any ideas?
0
 
Kim RyanIT ConsultantCommented:
Only guessing but perhaps this means an error at line 100 of the script? You may want to try manually compressing a log first to see the configuration is OK.
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now