If you have been running MailStore for any length of time you may have noticed there are a number of log files created by MailStore. Each time an archive profile runs a separate log file is created. This can lead to a large number of log files in a short period of time.
Where are the MailStore log files stored?
Depending on the OS, MailStore will store the log files in one of the following two locations:
1. Windows 2003 Server and earlier OSs. C:\Documents and Settings\All Users\Application Data\MailStore\TaskLog\
2. Windows Vista and newer OSs. C:\ProgramData\MailStore\TaskLog\
What information do these logs hold?
These logs store general information for each specific archive job. If an error occurs while the archive job is running then it will be noted in these logs. Each time an archive job runs a new log file is created. If you look at the log files in the “TaskLog” folder you will see that each log file name is proceeded by a number. This number directly correlates to the archive job’s ID number. This ID number can be found by logging in to the MailStore Client as the admin, expand Administrative Tools –> Miscellaneous –> Scheduled Task on <COMPUTER_NAME>. If needed, expand the ‘Name’ column and you’ll find the ID number is listed at the end of the name of the scheduled task.
How do we delete old MailStore logs?
Currently, MailStore doesn’t have an option built in for this but we can use the forfiles.exe command (included in the Windows Resource Kit since Windows 2003 Server) to look for files older than X number of days and remove them. Below is the command we use on our server running Windows 2008 R2 where the logs are being stored in the ProgramData folder.
forfiles /P “C:\ProgramData\MailStore\TaskLog” /S /M *.log /D -30 /C “cmd /c del @file”
The above command would remove any *.log file older than 30 days. Replace “30” in this command for how many days of log file you wish to retain. For example if you wish to only have one week worth of logging to look at replace “30” with “7”. We have then created a batch file with this command and run it once a week using the Windows Task Scheduler.
If you are interested in what the syntax of this command means you can run the forfiles command with a /? switch for usage instructions.
Any questions? Need help? Send us an email! email@example.com