Instructions on How to Delete Exchange Log Files

Updated On - October 25, 2023 by Nasir Khan | Reading Time: 5 minutes

Even though exchange log files are essential to the server’s operation, their size might become an issue if the server is overworked. To learn about how to delete Exchange log files, their size issues and know, how to fix them, see this blog article.

Exchange Log Files are used to keep track of Exchange Server data

The database file, checkpoint file, and log file are all stored on Exchange Server. Here, we’ll take a look at the Exchange log files, which are used to keep track of all server transactions. To restore or recover from Exchange server failures, it may be played back or committed to Exchange Server databases. As long as changes to the data are made to the log files, it is possible for the data to be committed to the database. Each backup of Exchange Server wipes out the old log files and creates new ones in their place.

The most critical Exchange transaction log to keep an eye on are the Diagnostic or Health Manager logs, the IIS logs, the ETL files, and the HTTP Proxy log. Exchange Server log files take up a substantial amount of storage space because of their high volume of information or transactions running through the server. Obviously, this isn’t the most perfect situation. There are a number of issues that may develop as a consequence of Exchange log files.

Exchange Log File issues

The large level of traffic on the Exchange server causes transaction log files to be produced and accumulated. As a result, the server is unable to handle any further requests. On certain days, ETL files under Diagnostics are generated hour by hour, taking up 50MB space at a time with a default entry of 100 files; similarly, IIS log files take up 200MB space or more and HTTP proxy file might take up 10MB storage space, all of which must be manually deleted. Because of this, the server may need to store up to a gigabyte of data.

Related Post: Export Exchange Server Mailbox to Outlook PST

A clogged-up Exchange Server log file collection may cause poor performance, unmounting of the Exchange database, inaccessibility of the server and data, and corrupting of the Exchange database.

Manual Ways to Delete Exchange Log Files

When log files are taking up too much space on Exchange Server, the best solution is to delete them. We’ll go through a variety of methods for achieving this objective in this post.

  • If you need to, you may remove it manually.
  • Getting rid of Diagnostic Logs is a straightforward procedure.
  • Using the Windows run box, Services.msc may be opened on the Exchange server’s computer.
  • Double-click on the service when you’ve located it.
  • Disable the service’s startup by first halting it and then setting it to disabled.
  • A similar setup is required for Microsoft Exchange Diagnostics.
  • To finish the operation, open the Task Scheduler on the Exchange system and go to Microsoft > Windows > PLA.

The right panel may be used to stop and disable the two presently executing tasks.

Now, go to C:\Program Files\Microsoft\Exchange Server\V15\Logging\Diagnostic and delete all logs available in DailyPerformanceLogs and PerformanceLogsToBeProcessed folders.

The following items should be removed from the ETL system:

Take a look at the map —

C:\Program Files\Microsoft\Exchange Server\V15\Bin\Search\Ceres\Diagnostics\ETLTraces

Remove all of the log files that are presently at that location.

In order to continue, please visit this page:

C:\Program Files\Microsoft\Exchange Server\V15\Bin\Search\Ceres\Diagnostics\Logs

Select all the log files in the folder and delete them permanently.

The following IIS files should be deleted:

Access the following directories and delete any log files that are stored inside them.

C:\inetpub\logs\LogFiles

C:\Program Files\Microsoft\Exchange Server\V15\Logging\RpcHttp

The log file folder may be found at this location, and the log files can be deleted from it.

C:\Program Files\Microsoft\Exchange Server\V15\Logging\HttpProxy

Exchange log files may be deleted in a variety of ways using the VSS Backup Script, one of which is this approach. Complete backup of the Exchange database causes the log files to be reduced instantly. The VSS Backup approach, which takes use of the Shadow copy functionality, may be used to produce a snapshot of the hard drive during the installation of Exchange Server. For this action, administrators must do the following steps consecutively in the Command Prompt window to truncate log files.

PS C:\>diskshadow

DISKSHADOW> add volume c:

DISKSHADOW> begin backup

DISKSHADOW> create

DISKSHADOW> end backup

DISKSHADOW> exit

Circular logging is enabled by using this option

To permanently delete old transaction logs, Exchange administrators may turn on a feature called Circular Logging and turn it off. When the available disc space is full, the Exchange log files are removed in a circular or revolving fashion, which is what this term means. Consequently, it helps to save hard disc space in a significant way. Find out how to activate Exchange 2010 circular logging.

Script for cleaning up log files: CleanupLogs.ps1

Exchange 2013 and later versions of Exchange may benefit from the CleanupLogs.ps1 script included in the Exchange Management Shell. Please go here to see the script.

Save the script supplied below as CleanupLogs.ps1 in a text file after copying and pasting it.

# Set execution policy if not set
$ExecutionPolicy = Get-ExecutionPolicy
if ($ExecutionPolicy -ne “RemoteSigned”) {
Set-ExecutionPolicyRemoteSigned -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\”
$ExchangeLoggingPath = “C:\Program Files\Microsoft\Exchange Server\V15\Logging\”
$ETLLoggingPath = “C:\Program Files\Microsoft\Exchange Server\V15\Bin\Search\Ceres\Diagnostics\ETLTraces\”
$ETLLoggingPath2 = “C:\Program Files\Microsoft\Exchange Server\V15\Bin\Search\Ceres\Diagnostics\Logs\”

# 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 -ErrorActionSilentlyContinue | out-null
}
}
Else {
Write-Host “The folder $TargetFolder doesn’t exist! Check the folder path!” -ForegroundColor “red”
}
} CleanLogfiles($IISLogPath)
CleanLogfiles($ExchangeLoggingPath)
CleanLogfiles($ETLLoggingPath)
CleanLogfiles($ETLLoggingPath2)

In the script above, you may change the number of days ($days =) to suit your requirements. On the Exchange system, store this script in C:scripts and then provide access to these folders to your users.

C:\inetpub\logs\LogFiles\

C:\Program Files\Microsoft\Exchange Server\V15\Logging\

C:\Program Files\Microsoft\Exchange Server\V15\Bin\Search\Ceres\Diagnostics\ETLTraces\

C:\Program Files\Microsoft\Exchange Server\V15\Bin\Search\Ceres\Diagnostics\Logs\

To run the script using PowerShell from the context-menu choices after logging in with a valid server account. Check the disc space again once the script has finished successfully to see whether it has been lowered.

In order to use the Windows Server backup mechanism

When used in combination with an Exchange plug-in, Windows Server Backup, a built-in Microsoft software, allows for the backup and restoration of Exchange server databases. To produce VSS-based Exchange data backups, truncation log files are utilized. Windows Server backup application will be used to back up and restore Exchange 2016.

In the end, we have a better understanding of how to deal with log files on the Exchange server system. A professional Exchange recovery application is available to you if the damage has already been done (i.e., if the Exchange database is no longer accessible due to corruption). Using the Regain Exchange EDB Recovery tool for corrupt or damaged Exchange databases content may be quickly restored and exported to the desired destinations or file formats.

Conclusion

A host of issues might arise if Exchange Server log files begin to build up on the server. There are a number of ways to control the accumulation. These log files, on the other hand, may be necessary if the whole Exchange database is damaged. However, you won’t have to worry about log files if you utilize a professional Exchange recovery solution.

https://www.regainsoftware.com/blog/wp-content/uploads/2024/03/Nasir.jpg

Author: Nasir Khan

I am Nasir Khan from India, working as a Content Developer in Regain Software. Here I am writing about our products and their updates. And writing some free solutions from converting emails or Cloud Migration process. We have tools like Email Converter, Emails backup and Cloud migration.

Leave a Reply

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