exchange-2007-shell-logo In earlier versions of Exchange Server the Message Tracking log settings were configured through the GUI interface.  Now with Exchange Server 2007 you can set the Message Tracking log path in the GUI, but you need to hit the Exchange Management Shell for other settings such as the log retention period.

To view the retention period on all of your Hub Transport servers you can use the Get-TransportServer cmdlet.

[PS] C:\>Get-TransportServer | fl name, messagetrackinglogmaxage, messagetrackin
glogpath


Name                     : SERVER1
MessageTrackingLogMaxAge : 30.00:00:00
MessageTrackingLogPath   : C:Program FilesMicrosoftExchange ServerTransport
                           RolesLogsMessageTracking

Name                     : SERVER2
MessageTrackingLogMaxAge : 30.00:00:00
MessageTrackingLogPath   : C:Program FilesMicrosoftExchange ServerTransport
                           RolesLogsMessageTracking

The MessageTrackingLogMaxAge attribute is in the format dd.hh:mm:ss (d = days, h = hours, m = minutes, s = seconds). To modify all of your Hub Transport servers to retain Message Tracking logs for 60 days you can pipe the Get-TransportServer cmdlet to the Set-TransportServer cmdlet.

[PS] C:\>Get-TransportServer | Set-TransportServer -MessageTrackingLogMaxAge 60.00:
00:00

Get-TransportServer will now reflect the new setting.

[PS] C:\>Get-TransportServer | fl name, messagetrackinglogmaxage, messagetrackin
glogpath


Name                     : SERVER1
MessageTrackingLogMaxAge : 60.00:00:00
MessageTrackingLogPath   : C:Program FilesMicrosoftExchange ServerTransport
                           RolesLogsMessageTracking

Name                     : SERVER2
MessageTrackingLogMaxAge : 60.00:00:00
MessageTrackingLogPath   : C:Program FilesMicrosoftExchange ServerTransport
                           RolesLogsMessageTracking

About the Author

Paul Cunningham

Paul is a former Microsoft MVP for Office Apps and Services. He works as a consultant, writer, and trainer specializing in Office 365 and Exchange Server. Paul no longer writes for Practical365.com.

Comments

  1. Adam Newman

    This post has been around for a while, but it was just useful to me. So for others that land here looking for help:

    This change may still not have the desired result. By default exchange only allows the C:Program FilesMicrosoftExchange ServerTransportRolesLogs directory to grow to 250mb. Depending on how busy your server is, you may need to increase that. The basic command is…

    Set-TransportServer SERVERHOSTNAME – MessageTrackingLogMaxDirectorySize 1024MB

  2. Abdul Waheed

    ok i got it- but following path shows logs for 30 days:

    E:Exchange Server 2007TransportRolesLogsMessageTracking

  3. Abdul Waheed

    ok- you are the man—-i got it. it means after every successful backup transaction logs are automatically removed. thanks a lot bro

    one more and hopefully last !!!!!

    i have tracking logs for past 30 days but when i track emails in exchange server, i found emails for past two days only…is there anything i am missing here as well?

    1. Avatar photo
      Paul Cunningham

      So a few days ago you changed your message tracking log retention from 1 day to 30 days, correct? So at this moment in time you’ve only got a couple of days worth of tracking logs there, right?

      So any message tracking query you run only has a few days logs to inspect. You can’t expect to see 30 days worth of results when you haven’t got 30 days worth of logs to inspect.

  4. Abdul Waheed

    Sorry if i have mixed things.its mailbox logs which are causing issue-

    E:Exchange Server 2007MailboxFirst Storage Group

    this is the path with 1 day logs- plz help

    1. Avatar photo
      Paul Cunningham

      Abdul, those are completely different. Those are the transaction logs for your databases. They are truncated when you run a backup (which I assume you are doing every night).

      I can think of no reason why you would want to keep 30 days worth of those logs.

  5. Abdul Waheed

    mentioned above command only showed:

    SERVER NAME

    i tried this command : Get-TransportServer | fl name, messagetrackinglogmaxage, messagetrackinglogpath

    and it showed 30.00:00

    but it still keeps logs for one day only

  6. Avatar photo
    Paul Cunningham

    Abdul, if you run:

    “Get-TransportServer | fl name, messagetrackinglog*”

    you should see output similar to this:

    MessageTrackingLogEnabled : True
    MessageTrackingLogMaxAge : 30.00:00:00

    Is your max age setting showing as 30 days, or still as 1 day?

  7. Abdul Waheed

    i have restarted exchange server. but it didnt worked……please help

  8. Abdul Waheed

    i had changed logs retention from 30 days to 1 day and it worked fine. but now i want revert these settings so i have changed logs retention age back to 30 days but it isnt working. mail server still keeps logs for 1 day ??? any idea ?

    1. Avatar photo
      Paul Cunningham

      Abdul, I haven’t really looked into it but my first thought would be to restart the MSExchangeTransport service to see if the change sticks after that.

  9. Jay

    Thanks for the tip! Works like a charm, couldn’t ask for more.

    Cheers

Leave a Reply