I had C:\ drive on Exchange Server running out of space. I used the TreeSizeFree tool to figure out what is taking up all the space. Noticed that log files under c:\inetpub\log\logfiles were growing and filling the space. Now, it is safe to remove these log files as they are NOT database log files.
I borrowed cleanup logs script from here Cleanup logs Exchange 2013/2016/2019 – ALI TAJRAN .Save the file as CleanupLogs.ps1 and run as an admin.
# Set execution policy if not set
$ExecutionPolicy = Get-ExecutionPolicy
if ($ExecutionPolicy -ne "RemoteSigned") {
Set-ExecutionPolicy RemoteSigned -Force
}
# Cleanup logs older than the set of days in numbers
$days = 2
# Path of the logs that you like to cleanup
$IISLogPath = "C:\inetpub\logs\LogFiles\"
# Clean the logs
Function CleanLogfiles($TargetFolder) {
Write-Host -Debug -ForegroundColor Yellow -BackgroundColor Cyan $TargetFolder
if (Test-Path $TargetFolder) {
$Now = Get-Date
$LastWrite = $Now.AddDays(-$days)
$Files = Get-ChildItem $TargetFolder -Recurse | Where-Object { $_.Name -like "*.log" -or $_.Name -like "*.blg" -or $_.Name -like "*.etl" } | Where-Object { $_.lastWriteTime -le "$lastwrite" } | Select-Object FullName
foreach ($File in $Files) {
$FullFileName = $File.FullName
Write-Host "Deleting file $FullFileName" -ForegroundColor "yellow";
Remove-Item $FullFileName -ErrorAction SilentlyContinue | out-null
}
}
Else {
Write-Host "The folder $TargetFolder doesn't exist! Check the folder path!" -ForegroundColor "red"
}
}
CleanLogfiles($IISLogPath)
Once the log files were cleared, following event was registered in the Exchange Sever event log:
Event 15005, MSExchangeTransport
The resource pressure decreased from Medium to Low. No components disabled due to back pressure.
The following resources are in normal state:
Private bytes
System memory
Version buckets[C:\Program Files\Microsoft\Exchange Server\V15\TransportRoles\data\Queue\mail.que]
Jet Sessions[C:\Program Files\Microsoft\Exchange Server\V15\TransportRoles\data\Queue\mail.que]
Checkpoint Depth[C:\Program Files\Microsoft\Exchange Server\V15\TransportRoles\data\Queue\mail.que]
Queue database and disk space (“C:\Program Files\Microsoft\Exchange Server\V15\TransportRoles\data\Queue\mail.que”)
Used disk space (“C:\Program Files\Microsoft\Exchange Server\V15\TransportRoles\data\Queue”)
Used disk space (“C:\Program Files\Microsoft\Exchange Server\V15\TransportRoles\data”)
Overall Resources