Log on Exchange 2010

Posted on 2014-04-10
Last Modified: 2014-04-25
Is it possible to clean the log (not the database log) on Exchange 2010 automatically as I see that there are many logs accumulated under C:\inetpub\logs\LogFiles\W3SVC1. Just wonder we can set the retention period for the log ...

Question by:AXISHK
LVL 12

Expert Comment

by:Md. Mojahid
ID: 39993319
As per me your can't do that.
LVL 19

Accepted Solution

Patricksr1972 earned 500 total points
ID: 39993421

W3SVC1 is most probable the logs for the default website in IIS. (where OWA lives)
You can easily write some simple powershell script which deletes entries older then x days.

Code would look like this and the job would be a scheduled task.

# Delete all Files in C:\inetpub\logs\LogFiles on yourservername older than 7 day(s)

$Path = "C:\inetpub\logs\LogFiles"
$Daysback = "-7"
$CurrentDate = Get-Date
$DatetoDelete = $CurrentDate.AddDays($Daysback)
Get-ChildItem $Path -Recurse | Where-Object { $_.LastWriteTime -lt $DatetoDelete } | Remove-Item

Author Closing Comment

ID: 40024002

Featured Post

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This article explains how to install and use the NTBackup utility that comes with Windows Server.
To show how to create a transport rule in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Mail Flow >> Rules tab.:  To cr…
The basic steps you have just learned will be implemented in this video. The basic steps are shown to configure an Exchange DAG in a live working Exchange Server Environment and manage the same (Exchange Server 2010 Software is used in a Windows Ser…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question