How do we find out what our Exchange server Message Tracking Logs settings are configured at?
The base command for this is Get-TransportServer. To get the message tracking log settings for your servers, use ‘Get-TransportServer |fl messagetracking*’

Now, you can do this on each of your servers in a table format to compare values by using this command – ‘Get-TransportServer |fl messagetracking*’

Out of the box Message Tracking Log settings are as follows:
- Enable or disable message tracking: The default is enabled.
- Specify the location of the message tracking log files
- Modify a maximum size for the individual message tracking log files: Default is 10MB.
- Max size for the directory with message tracking log files: Default is 1000MB
- Specify maximum age for the message tracking log files: The default is 30 days.
- Message subject logging in the message tracking logs: Default is enabled
Source: http://technet.microsoft.com/en-us/library/bb124375(v=exchg.141).aspx
As you can see from the second screenshot that the settings for the servers are all over the place, from the retention time to the max directory size. So how could this be standardized across the board? First you need to come up with a value that makes sense for all servers. Let’s go through each to determine a good methodology for each setting:
- Modify a maximum size for the individual message tracking log files
The only reason I would modify this is to lower the number of files generated. For example if you generating 1 GB or 1 TB of logs a day, you might like this file to be 100 MB to lessen the number of files generated for tracking. Other than that, the 10 MB file size should be good for the logs.
- Max size for the directory with message tracking log files
This number, which by default is 1000MB, will go hand in hand with the max age of your files. What I generally do is get some rough numbers from existing servers to get an idea what the size of logs are generated per day. Then I get requirement for how long the tracking needs to be around for searches and multiple that then add some fudge factor like 10% or 25% depending on the environment. So if I have a server that generates 100 MB of logs a day on average and the server needs to retain logs for 45 days, we could do 5 GB which would be 10X450MB + ~10%.
- Specify maximum age for the message tracking log files
This setting goes hand in hand with the above setting. This setting is determined by how far back I need to search logs. I usually do monthly incrementals like 30, 60, 90 or 120 days.
To make these changes in bulk you just need a single Powershell command, known as a one liner:
If I wanted to configure all of my servers to 180 days, 10 GB and change the default file size from 10 MB to 100 MB, I would use this command:
get-transportserver | set-transportserver -MessageTrackingLogMaxAge 180 -MessageTrackingLogMaxDirectorySize 10GB -MessageTrackingLogMaxFileSize 100MB
That’s it. All of your servers will not conform.
TechNet Reference
http://technet.microsoft.com/en-us/library/bb125246(v=exchg.141).aspx
http://technet.microsoft.com/en-us/library/bb124151(v=exchg.141).aspx
Thanks for this..
Please note that you have “Maz” instead of “Max” in your last command.
-MessageTrackingLogMazDirectorySize
Cheers
Fixed. Thanks for the catch.
Hi,
Do any service restart required? Because i have set retention to 30 days from 1 day but it is still flushing logs after 1 day.
Regards,
Sarfraz
You need to restart the ‘Microsoft Exchange Transport’ service.