Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 263
  • Last Modified:

Log on Exchange 2010

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 ...

Tks
0
AXISHK
Asked:
AXISHK
1 Solution
 
Md. MojahidCommented:
As per me your can't do that.
0
 
Patrick BogersDatacenter platform engineer LindowsCommented:
Hi

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
0
 
AXISHKAuthor Commented:
tks
0

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

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