September 3, 2010

EMS – Exchange Server 2007 Message Tracking log file retention

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 Files\Microsoft\Exchange Server\Transport
                           Roles\Logs\MessageTracking

Name                     : SERVER2
MessageTrackingLogMaxAge : 30.00:00:00
MessageTrackingLogPath   : C:\Program Files\Microsoft\Exchange Server\Transport
                           Roles\Logs\MessageTracking

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 Files\Microsoft\Exchange Server\Transport
                           Roles\Logs\MessageTracking

Name                     : SERVER2
MessageTrackingLogMaxAge : 60.00:00:00
MessageTrackingLogPath   : C:\Program Files\Microsoft\Exchange Server\Transport
                           Roles\Logs\MessageTracking

Comments

  1. Jay says:

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

    Cheers

  2. Abdul Waheed says:

    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 ?

  3. Abdul Waheed says:

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

  4. 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?

  5. Abdul Waheed says:

    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. Abdul Waheed says:

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

    E:\Exchange Server 2007\Mailbox\First Storage Group

    this is the path with 1 day logs- plz help

    • 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.

  7. Abdul Waheed says:

    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?

    • 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.

  8. Abdul Waheed says:

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

    E:\Exchange Server 2007\TransportRoles\Logs\MessageTracking

Leave a Comment

*