Moving Logs to Make Room on the OS Drive

Filed in Microsoft Exchange 2010, PowerShell
Share this solution!

If you want the best performance possible from your Exchange server, then you need to buy high performance disk drives for your OS drive. The fastest drives also happen to be the smallest drives, which means that you have to move as much of data as possible to secondary drives. Unless you run a very small Exchange organization, you don’t want to keep your databases or database logs on the same drive as your operating system. It’s standard practice with database and application servers to put databases on a dedicated data drive. So it surprises a lot of people that the default location for Exchange databases is on the C: drive. And that’s not all. IIS and Exchange also save their log files to the C: drive by default. Admittedly, these logs don’t take nearly as much space as the databases, but when you’re tight on space, every little bit helps.

The hub transport server is the most likely place for log files to become a problem. There are eight transport logs:

Log Name Default Log Path
Message Tracking Log C:\Program Files\Microsoft\Exchange Server\V14\TransportRoles\Logs\MessageTracking
Connectivity Log C:\Program Files\Microsoft\Exchange Server\V14\TransportRoles\Logs\Connectivity
Send Protocol Log C:\Program Files\Microsoft\Exchange Server\V14\TransportRoles\Logs\ProtocolLog\SmtpSend
Receive Protocol Log C:\Program Files\Microsoft\Exchange Server\V14\TransportRoles\Logs\ProtocolLog\SmtpReceive
IRM Log C:\Program Files\Microsoft\Exchange Server\V14\Logging\IRMLogs
Active User Statistics Log C:\Program Files\Microsoft\Exchange Server\V14\TransportRoles\Logs\ActiveUsersStats
Server Statistics Log C:\Program Files\Microsoft\Exchange Server\V14\TransportRoles\Logs\ServerStats
Routing Table Log C:\Program Files\Microsoft\Exchange Server\V14\TransportRoles\Logs\Routing

 

Only the first four of these log file paths are accessible from the Exchange Management Console (EMC).

Transport log file locations in the Exchange Management Console

Transport log file locations in the Exchange Management Console

 

You can change those paths from the EMC if you like, but if you have more than a small handful of transport servers, the process could become tedious. Since you’ll have to use the Exchange Management Shell (EMS) to change the other four, you might as well do all eight at once. Here’s a short script you can run that will change the path for all of your servers simultaneously to D:\Logs. If you don’t like that path, of course, you can change it to suit your requirements. Make sure that the paths exist and that the server has access to it.

Get-TransportServer | foreach {
Set-TransportServer -MessageTrackingLogPath “D:\Logs\MessageTracking”
Set-TransportServer -ConnectivityLogPath “D:\Logs\Connectivity”
Set-TransportServer -IrmLogPath “D:\Logs\IRMLogs”
Set-TransportServer -ActiveUserStatisticsLogPath “D:\Logs\ActiveUserStats”
Set-TransportServer -ServerStatisticsLogPath “D:\Logs\ServerStats”
Set-TransportServer -ReceiveProtocolLogPath “D:\Logs\ProtocolLog\SmtpReceive”
Set-TransportServer -RoutingTableLogPath “D:\Logs\Routing”
Set-TransportServer -SendProtocolLogPath “D:\Logs\ProtocolLog\SmtpSend”
}

Once that is done, you can verify that the paths are set correctly for any given server by running this command in EMS:

Get-TransportServer <servername> | select *logpath

The logs will begin writing to the new path immediately. You shouldn’t have to restart the server or any services. If you have any applications that use these logs for monitoring system health, you will probably have to update those apps. Here are instructions for updating Systems Operations Manager: Empty Exchange 2010 Server Statistics/Mailflow Reports if default log directory has changed.

Client Access Servers might also have a problem with log files, but in that case, it will probably be the IIS logs rather than the Exchange logs. That’s a topic for some other day.

 
Click to view/hide

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Powered by sweet Captcha

 
Click to view/hide