Thursday 23 April 2015

Clearing out (saving space) old log files in Exchange 2013

Database log files can soon grow widely out of control and consume all of your disk if they are not monitored properly. The following will demonstrate how you can remove log files that are no longer required by the database - in order to clear some disk space.

We should firstly identify the database location (.edb) and the log file directory:

Get-MailboxDatabase -Identity "Database Name" | FT LogFolderPath,EdbFilePath

We should then use eseutil to identify the last checkpoint. A checkpoint simply tells us where the database is up to with the logs it has consumed / read - although we must firstly dismount the database:

Dismount-Database <database-name>

and then find the last checkpoint (pointing it at the .CHK file within the log file directory!) for an offline database:

eseutil /mk "D:\Database1\Logs\E01.chk"

OR for an online database:

eseutil /mk "D:\Database1\Logs\E01.chk" /vss /vssrec eNN "D:\Database1\Logs\"

Within the output you should see something like:

Checkpoint: (0xDA8EE,C0,0)

The hexidecimal value 'DA8EE' reperesents the newest logfile that has not been committed i.e. anything older than this can be deleted!

So in this example we would delete DA8ED.log, DA8EC.log and so on.

0 comments:

Post a Comment