Back Pressure Insufficient system resources

When you notice that your Exchange Server does not accept new mails or delivers them with a delay to user mailboxes , you can verify the symptoms regarding Back Pressure insufficient system resources in this post :
Verify Back Pressure Exchange 2013 / 2016

After you have determined Back Pressure as the root cause and it is disk space related ( Event ID 15006 ) it is time to wipe parts of the logs and traces which are eating up your disk space.  Especially if you have more servers in your environment  and you assume that some or all of them can be exposed to the risk of Back Pressure insufficient system resources ,  the following script can help you in a very convenient way.

This script was written by my colleague    .  It is proper commented which will make it easy to fine tune it for your needs. You can specify some or all servers in your environment the script should take in account. The paths are relative to Exchange installed at the default location. ( C:\Program Files ).

#
#
# 
Add-PSSnapin *exchange* -ErrorAction SilentlyContinue
# datetime parameter to measure the CERES logs LastWriteTime against
$dateCERES = (Get-Date).AddHours(-4)
# datetime parameter to measure the DailyPerformanceLogs LastWriteTime against
$dateDPL = (Get-Date).AddDays(-1)
# datetime paramete for inetpub logs
$dateinetpub = (Get-Date).AddDays(-4)
# datetime parameter for all other logs
$dateother = (Get-Date).AddHours(-8) 
# all mailboxservers or specified mailboxservers
$mbservers = Get-MailboxServer | Sort-Object name
#$mbservers = "Server01","Server02" ,"Server03"
Write-Host "Deleting the specified logs on the following servers..."
FOREACH ($mbserver in $mbservers)
{
# tracker for human eyes 🙂
$mbserver.Name
# get and delete both types of CERES logs
Get-ChildItem -Path "\\$mbserver\C$\Program Files\Microsoft\Exchange Server\V15\Bin\Search\Ceres\Diagnostics\ETLTraces" | Where-Object {$_.lastwritetime -lt $dateCERES -and $_.Extension -eq ".etl"} | Remove-Item
Get-ChildItem -Path "\\$mbserver\C$\Program Files\Microsoft\Exchange Server\V15\Bin\Search\Ceres\Diagnostics\Logs" | Where-Object {$_.lastwritetime -lt $dateCERES -and $_.Extension -eq ".log"} | Remove-Item
# get and delete DailyPerformanceLogs
Get-ChildItem -Path "\\$mbserver\C$\Program Files\Microsoft\Exchange Server\V15\Logging\Diagnostics\DailyPerformanceLogs" | Where-Object {$_.lastwritetime -lt $dateDPL -and $_.Extension -eq ".blg"} | Remove-Item
# get and delete ews and httpproxy logs, except for powershell
Get-ChildItem -Path "\\$mbserver\C$\Program Files\Microsoft\Exchange Server\V15\Logging\HttpProxy\Autodiscover" | Where-Object {$_.lastwritetime -lt $dateother -and $_.Extension -eq ".log"} | Remove-Item
Get-ChildItem -Path "\\$mbserver\C$\Program Files\Microsoft\Exchange Server\V15\Logging\HttpProxy\Eas" | Where-Object {$_.lastwritetime -lt $dateother -and $_.Extension -eq ".log"} | Remove-Item
Get-ChildItem -Path "\\$mbserver\C$\Program Files\Microsoft\Exchange Server\V15\Logging\HttpProxy\Ecp" | Where-Object {$_.lastwritetime -lt $dateother -and $_.Extension -eq ".log"} | Remove-Item
Get-ChildItem -Path "\\$mbserver\C$\Program Files\Microsoft\Exchange Server\V15\Logging\HttpProxy\Ews" | Where-Object {$_.lastwritetime -lt $dateother -and $_.Extension -eq ".log"} | Remove-Item
Get-ChildItem -Path "\\$mbserver\C$\Program Files\Microsoft\Exchange Server\V15\Logging\HttpProxy\Mapi" | Where-Object {$_.lastwritetime -lt $dateother -and $_.Extension -eq ".log"} | Remove-Item
Get-ChildItem -Path "\\$mbserver\C$\Program Files\Microsoft\Exchange Server\V15\Logging\HttpProxy\Oab" | Where-Object {$_.lastwritetime -lt $dateother -and $_.Extension -eq ".log"} | Remove-Item
Get-ChildItem -Path "\\$mbserver\C$\Program Files\Microsoft\Exchange Server\V15\Logging\HttpProxy\Owa" | Where-Object {$_.lastwritetime -lt $dateother -and $_.Extension -eq ".log"} | Remove-Item
Get-ChildItem -Path "\\$mbserver\C$\Program Files\Microsoft\Exchange Server\V15\Logging\HttpProxy\OwaCalendar" | Where-Object {$_.lastwritetime -lt $dateother -and $_.Extension -eq ".log"} | Remove-Item
Get-ChildItem -Path "\\$mbserver\C$\Program Files\Microsoft\Exchange Server\V15\Logging\HttpProxy\RpcHttp" | Where-Object {$_.lastwritetime -lt $dateother -and $_.Extension -eq ".log"} | Remove-Item
Get-ChildItem -Path "\\$mbserver\C$\Program Files\Microsoft\Exchange Server\V15\Logging\Ews" | Where-Object {$_.lastwritetime -lt $dateother -and $_.Extension -eq ".log"} | Remove-Item
# get and delete activemonitoringtracelogs  
Get-ChildItem -Path "\\$mbserver\C$\Program Files\Microsoft\Exchange Server\V15\Logging\Monitoring\Monitoring\MSExchangeHMWorker\ActiveMonitoringTraceLogs" | Where-Object {$_.lastwritetime -lt $dateother -and $_.Extension -eq ".log"} | Remove-Item
# get and delete probecache & respondercache logs
Get-ChildItem -Path "\\$mbserver\C$\Program Files\Microsoft\Exchange Server\V15\Logging\Monitoring\PersistentState\ProbeCache" | Where-Object {$_.lastwritetime -lt $dateother -and $_.Extension -eq ".log"} | Remove-Item
Get-ChildItem -Path "\\$mbserver\C$\Program Files\Microsoft\Exchange Server\V15\Logging\Monitoring\PersistentState\ResponderCache" | Where-Object {$_.lastwritetime -lt $dateother -and $_.Extension -eq ".log"} | Remove-Item
# get and delete inetpub logfiles
Get-ChildItem -Path "\\$mbserver\C$\inetpub\logs\LogFiles\W3SVC1" | Where-Object {$_.lastwritetime -lt $dateinetpub -and ($_.Extension -eq ".log" -or $_.Extension -eq ".zip")} | Remove-Item    
} 

You can set this script as a scheduled task to have the logs cleaned up on a regular base to prevent Back Pressure insufficient system resources.

If you haven’t done it already you can move the mail.que file to a location on another drive to free up even more disk space.

Change location of mail.que file Exchange 2013 / 2016

2 Likes

Leave a Reply

Your email address will not be published. Required fields are marked *