Google
Search WWW Search msexchangetips.blogspot.com

Saturday, August 19, 2006

Exchange: Managing SMTP and IIS Log Files via Script

Summary:

Exchange can can log a number of transactions such as SMTP, IIS, or Message Tracking. These logs play an important role in troubleshooting, trending as well as a number of other things. However, Exchange or IIS does not provide an option to automatically purge SMTP or IIS logs. In this article, I will provide an example to manage these log files.

Procedure:

Since you want to always keep a copy of your log files, for example 30 days worth before purging them, what this script will do is first move all log files from the directory you specify to another partition E:\logs that are older than 30 days, then delete any log files older than 60 days from E:\logs.



1. Create a folder in C:\scripts (Or anywhere you want to designate)

2. Download WaRmZip from SoureForge. http://sourceforge.net/project/showfiles.php?group_id=88417&package_id=99571 Download file to C:\scripts

3. Open notepad and enter the following:

:: movelogs.bat
:: moves log files from the directory you specify below
::
@ECHO OFF

C:
CD\scripts\waRmZip16

waRmZip.wsf /r /q "C:\logs" /ma:30 /md:E:\Logs_Old

This script will move any log files older than 30 days from C:\logs to E:\logs_old folder. You will need to modify this line to point to where your SMTP or IIS logs are and your destination path. Save this file as movelogs.bat

4. Open notepad and copy the following:

:: deletelogs.bat
:: Delete logs older than 60 days to run every 60 days.
::
@ECHO OFF

C:
CD\scripts

waRmZip.wsf /r "E:\Logs_Old" /da:60 /df /q

Save this file as deletelogs.bat


5. Now go to scheduled tasks and schedule movelogs.bat to run monthly and deletelogs.bat to run every 60 days.

Note: Ensure you test this using test directories before implementing them into production. I have also provided these files on "Chong Man"s Exchange Resources" under links.


James Chong
MCSE M+, S+, MCTS, Security+
msexchangetips.blogspot.com

How useful was this article? Want to see a tip not listed? Please leave a comment.

5 Comments:

Anonymous Anonymous said...

This article is very useful. I've been messing around with VB scripts all morning, but this is very simple to understand and modify. It's exactly what I've been looking for!

5:05 AM  
Anonymous Anonymous said...

I get

Line 856
Char 6
"The Handle is invalid".

5:54 AM  
Blogger oakleyses said...

burberry pas cher, lunette oakley pas cher, coach outlet, kate spade outlet, true religion jeans, converse, coach outlet, longchamp soldes, north face uk, michael kors, louboutin pas cher, new balance, lululemon outlet, coach purses, nike air max, hermes pas cher, nike tn pas cher, vans pas cher, coach outlet store online, mulberry uk, lunette ray ban pas cher, nike air max uk, sac guess pas cher, nike air force, nike roshe run pas cher, longchamp pas cher, north face pas cher, nike air max pas cher, ray ban uk, true religion outlet, abercrombie and fitch, polo lacoste pas cher, true religion outlet, michael kors, jordan pas cher, nike free, polo ralph lauren uk, vanessa bruno pas cher, true religion outlet, hogan sito ufficiale, ralph lauren pas cher, michael kors outlet online, nike free pas cher, nike roshe uk, abercrombie and fitch UK, nike blazer pas cher, hollister uk

6:31 PM  
Blogger John said...

canada goose jackets
canada goose jackets
mont blanc pens
concords 11
toms
instyler curling iron
michael kors outlet
polo ralph lauren
coach factory outlet
michael kors outlet
hollister clothing
michaek kors handbags
marc jacobs
tory burch sale
louis vuitton handbags
michael kors outlet
louis vuitton bags
gucci shoes
ugg boots on sale
coach outlet
michael kors outlet
jordan concords
coach outlet online
louis vuitton handbags
christian louboutin outlet
oakley sunglasses
north face jacket
ralph lauren uk
ugg boots outlet
vans shoes
louis vuitton bags
air jordan retro
20151203yuanyuan

7:10 PM  
Blogger Unknown said...

michael kors handbags
valentino outlet
pony outlet
coach outlet
kd 9 shoes
polo ralph lauren shirts
longchamp bags
nike mercurial vapor
longchamp handbags
christian louboutin heels
2017.4.6chenlixiang

11:51 PM  

Post a Comment

<< Home

xml:lang="en" lang="en"> MS Exchange Tips: Exchange: Managing SMTP and IIS Log Files via Script