How To: Manage Exchange 2013 Daily Performance Logs
Exchange 2013 isn’t exactly new at this point, but with every cumulative update(CU) Microsoft seems to find more things to change. Since the release of Exchange 2013 there are 3 log files that have caused some issues for me in my professional life. The Daily Performance logs, the OWA logs, and ECP logs. The Daily Performance Logs is the biggest annoyance out of the 3 but the other 2 can add up as well.
For those who don’t know The Daily Performance Logs are a scheduled task that runs certain performance counts in performance monitor. These daily logs are between 600mb and 1 gig a day for a small company and grow based on server usage. You can disable the scheduled task, but then at 3am The Microsoft Exchange Diagnostics Service will crash and then automatically restart. The reason the service crashes is because the Diagnostic Service is trying to interact with the Daily Performance Logs scheduled task, if the task is disabled then it can’t interact with it and crashes. I know that doesn’t sound like a big deal overall, but if you have a network monitoring software it could generate an alert… Every day. I’ll take this a step further, Professionally I work for an MSP so if I were to disable the schedule task then I would have alerts triggering every day for all of our clients that run Exchange 2013. Needless to say I came up with a better solution.
The Daily Performance Logs, OWA Logs, and ECP Logs are not flushed out by backup software either. The simplest solution is to create a scheduled task to run a script to automatically delete the log files. To do this I decided to use PowerShell scripting to accomplish this task.
In the following script is set to delete the log files that are older then 3 days and the script is configured to use the default Exchange/IIS locations. If you changed those locations you’ll have to update the script.
#----- Daily Performance Logs-----# #----- define parameters -----# #----- get current date ----# $Now = Get-Date #----- define amount of days ----# $Days = "3" #----- define folder where files are located ----# $TargetFolder = "C:\Program Files\Microsoft\Exchange Server\V15\Logging\Diagnostics\DailyPerformanceLogs" #----- define extension ----# $Extension = "*.blg" #----- define LastWriteTime parameter based on $Days ---# $LastWrite = $Now.AddDays(-$Days) $Files = Get-Childitem $TargetFolder -Include $Extension -Recurse | Where {$_.LastWriteTime -le "$LastWrite"} Remove-Item $Files #----- W3SVC1 Folder-----# #----- define folder where files are located ----# $TargetFolder1 = "C:\inetpub\logs\LogFiles\W3SVC1" #----- define extension ----# $Extension1 = "*.log" #----- define LastWriteTime parameter based on $Days ---# $LastWrite = $Now.AddDays(-$Days) $Files1 = Get-Childitem $TargetFolder1 -Include $Extension1 -Recurse | Where {$_.LastWriteTime -le "$LastWrite"} Remove-Item $Files1 #----- W3SVC2 Folder-----# #----- define folder where files are located ----# $TargetFolder2 = "C:\inetpub\logs\LogFiles\W3SVC2" #----- define extension ----# $Extension2 = "*.log" #----- define LastWriteTime parameter based on $Days ---# $LastWrite = $Now.AddDays(-$Days) $Files2 = Get-Childitem $TargetFolder2 -Include $Extension2 -Recurse | Where {$_.LastWriteTime -le "$LastWrite"} Remove-Item $Files2
I configured the script for to delete items older then 3 days just incase there was a server issue and they were required to fix it. So far I haven’t looked at those logs once, but that doesn’t mean I’ll never have to do it.
Then to finish this out create a scheduled task and let it run whenever works best for you. Remember that the account that you use to run the script will need the log on as a service active directory right.
Good Luck,
-T
I thought you had to leave them because the exchange databases uses them.
You are correct that the Exchange Database Logs are needed. The logs that I mentioned above are not the Exchange Database logs. They are the Client Access logs and the Daily Performance Logs. The Client Access logs track every time a user/device connects to the Exchange server. The Daily Performance Logs are predefined Exchange performance counters that has some useful information but suck up a lot of space. Roughly 600mbs to 1 gig a day on a small exchange server.
Nice script, works great.
Recently Updated to 2013 and watched my CAS servers fill up very fast of course it was the logs, BUT 600mb+ per file!
Sweet. Thanks a lot! These things were killing my VM disk space.
thx. i see it still works on Exchange 2016 also. just tested it
Thanks for testing that. I haven’t had a chance to test Exchange 2016 yet