Applies to: Exchange Server 2013

Topic Last Modified: 2012-10-03

Agent logging records the actions performed by specific Exchange anti-spam agents. The information written to the agent log depends on the agent, the SMTP event, and the action performed on the message.

What do you need to know before you begin?

  • Estimated time to complete: 15 minutes

  • You need to be assigned permissions before you can perform this procedure or procedures. To see what permissions you need, see the "Transport Service" and "Edge Transport server" entries in the Mail Flow Permissions topic.

  • By default, anti-spam features aren't enabled in the Transport service on a Mailbox server. Typically, you only enable the anti-spam features on a Mailbox server if your Exchange organization doesn't do any prior anti-spam filtering before accepting incoming messages. For more information, see Enable Anti-Spam Functionality on a Mailbox Server.

  • You can't use the Exchange admin center (EAC) to perform this procedure. You can only use the Shell.

  • For information about keyboard shortcuts that may apply to the procedures in this topic, see Keyboard Shortcuts in the Exchange Admin Center.

Tip:
Having problems? Ask for help in the Exchange forums. Visit the forums at: Exchange Server, Exchange Online, or Exchange Online Protection

Use the Shell to configure anti-spam agent logging

Run the following command:

Copy Code
Set-TransportService <ServerIdentity> -AgentLogEnabled <$true | $false> -AgentLogMaxAge <dd.hh:mm:ss> -AgentLogMaxDirectorySize <Size> -AgentLogMaxFileSize <Size> -AgentLogPath <LocalFilePath>

This example sets the following agent log settings on the Mailbox server named Mailbox01:

  • Sets the location of the agent log files to D:\Anti-Spam Agent Log. Note that if the folder doesn't exist, it will be created for you.

  • Sets the maximum size of an agent log file to 20 MB.

  • Sets the maximum size of the agent log directory to 400 MB.

  • Sets the maximum age of an agent log file to 14 days.

Copy Code
Set-TransportService Mailbox01 -AgentLogPath "D:\Anti-Spam Agent Log" -AgentLogMaxFileSize 20MB -AgentLogMaxDirectorySize 400MB -AgentLogMaxAge 14.00:00:00
Note:
  • If you set the AgentLogPath parameter to the value $null, you effectively disable agent logging. However, if you set AgentLogPath to $null when the value of the AgentLogEnabled parameter is $true, event log errors are generated. The preferred method to disable agent logging is to set AgentLogEnabled to $false.

  • Setting the AgentLogMaxAge parameter to the value 00:00:00 prevents the automatic removal of agent log files because of their age.

For detailed syntax and parameter information, see the AgentLog parameters in Set-TransportService.

How do you know this worked?

To verify that you have successfully configured anti-spam agent logging, do the following:

  1. In the Shell, run the following command:

    Copy Code
    Get-TransportService <ServerIdentity> | Format-List AgentLog*
    
  2. Verify the values displayed are the values you configured.