How to automatically purge Exchange-related logs

If you aren't fortunate enough to have a lot of free disk space on hand, you may only want to keep logs you absolutely need, so you don't negatively impact performance. Learn how you can automate the process of purging HTTP, SMTP and UCE Archive logs that are past a certain age.

Given how cheap storage has become, it's now possible to keep detailed logs for most of your services going back months or even years.

But if you aren't fortunate enough to have a lot of free disk space on hand, you may only want to keep logs you absolutely need, so you don't negatively impact performance.

Performance considerations become doubly important if you use third-party utilities to analyze logs and report results; if you're allowing those programs to search all available logs, the analysis will slow to a crawl.

There are a couple of ways to deal with a backlog of logs:

  1. Go through them by hand and manually delete the old ones. 
    This is probably more of an investment of time and energy than most system administrators want to put in.

     

  2. Have a script or program purge them when they're more than a certain age.
    This is probably the most useful, since the interval can usually be adjusted freely.

Exchange Server expert Jim McBee has drafted a set of scripts to do exactly that: one for purging HTTP logs, another for SMTP logs, and a third for the UCE Archive (i.e., Microsoft Exchange's spam trap).

In each script, there are three parameters to be modified:

  • The folder that contains the log files you want to purge
  • A folder to generate a logfile of script actions
  • The number of days files are to be kept

These parameters are fairly well-documented within each script. So if you have a familiarity with VBScript, it shouldn't be difficult to customize them.

NOTE: Files deleted with these scripts are hard-deleted. They are not sent to the Recycle Bin and cannot be recovered, except perhaps through specialized undelete tools, so use them with care.

About the author:
Serdar Yegulalp is editor of the Windows Power Users Newsletter.

Do you have comments on this tip? Let us know.

Related information from SearchExchange.com:

 

This was first published in May 2006

Dig deeper on Microsoft Exchange Server Monitoring and Logging

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchWindowsServer

SearchEnterpriseDesktop

SearchCloudComputing

SearchSQLServer

Close