Fortinet black logo

Administration Guide

Configuring logging

Configuring logging

The Log Setting submenu includes two tabs, Local and Remote, that let you:

  • set the severity level
  • configure which types of log messages to record
  • specify where to store the logs

You can configure the FortiMail unit to store log messages locally (that is, in RAM or to the hard disk), remotely (that is, on a Syslog server or FortiAnalyzer unit), or at both locations.

Your choice of storage location may be affected by several factors, including the following:

  • Local logging by itself may not satisfy your requirements for off-site log storage.
  • Very frequent logging may cause undue wear when stored on the local hard drive. A low severity threshold is one possible cause of frequent logging. For more information on severity levels, see Log message severity levels.

For information on viewing locally stored log messages, see Viewing log messages.

See also

Configuring logging to a Syslog server or FortiAnalyzer unit

Configuring logging to the hard disk

Configuring logging to the hard disk

You can store log messages locally on the hard disk of the FortiMail unit.

To ensure that local hard disk has sufficient disk space to store new log messages and that it does not overwrite existing logs, you should regularly download backup copies of the oldest log files to your management computer or other storage, and then delete them from the FortiMail unit (alternatively, you could configure logging to a remote host).

You can view and download these logs from the Log submenu of the Monitor tab. For more information, see Viewing log messages.

For logging accuracy, you should also verify that the FortiMail unit’s system time is accurate. For details, see Configuring the time and date.

To access this part of the web UI, your administrator account’s:

  • Domain must be System
  • access profile must have Read or Read-Write permission to the Others category

For details, see About administrator account permissions and domains.

To configure logging to the local hard disk
  1. Go to Log & Report > Log Setting > Local.
  2. Select the Enable option to allow logging to the local hard disk.
  3. In Log file size, enter the file size limit of the current log file in megabytes (MB).
  4. In Log time, enter the time (in days) of file age limit. Valid range is between 1 and 365 days.
  5. In At hour, enter the hour of the day (24-hour format) when the file rotation should start.
  6. When a log file reaches either the age or size limit, the FortiMail unit rotates the current log file: that is, it renames the current log file (elog.log) with a file name indicating its sequential relationship to other log files of that type (elog2.log, and so on), then creates a new current log file. For example, if you set the log time to 10 days at hour 23, the log file will be rotated at 23rd hour of the 10th day (23:00).

    Note

    Large log files may decrease display and search performance.

  7. From Log level, select the severity level that a log message must equal or exceed in order to be recorded to this storage location.
  8. Caution

    Avoid recording log messages using low severity thresholds such as Information or Notification to the local hard disk for an extended period of time. A low log severity threshold is one possible cause of frequent logging. Excessive logging frequency can cause undue wear on the hard disk and may cause premature failure.

    For information about severity levels, see Log message severity levels.

  9. For Log retention period, specify how long (in days) the logs will be kept. Valid range is 0 to 1461 days. 0 means no limit.
  10. From Log options when disk is full, select what you want to do when the log partition of the local disk is almost full, meaning that less than 5 percent of the disk space or 1.5 GB, whichever is smaller, is left.
  • Do not log: Discard all new log messages.
  • Overwrite: Delete the oldest log file in order to free disk space, and store the new log messages. Oldest files of all log types will be deleted until 15 percent of the disk space or 22.5 GB, whichever is smaller, is reached.
  • In Logging Policy Configuration, enable the types of logs that you want to record to this storage location. Click the arrow to review the options.
  • Click Apply.
  • See also

    Log message severity levels

    Configuring logging to a Syslog server or FortiAnalyzer unit

    Instead of or in addition to logging locally, you can store log messages remotely on a Syslog server or a FortiAnalyzer unit. For information about how many remote Syslog servers your FortiMail model can support, see Appendix B: Maximum Values.

    Note

    Logs stored remotely cannot be viewed from the web UI of the FortiMail unit. If you require the ability to view logs from the web UI, also enable local storage. For details, see Configuring logging to the hard disk.

    Before you can log to a remote location, you must first enable logging. For logging accuracy, you should also verify that the FortiMail unit’s system time is accurate. For details, see Configuring the time and date.

    To access this part of the web UI, your administrator account’s:

    • Domain must be System
    • access profile must have Read or Read-Write permission to the Others category

    For details, see About administrator account permissions and domains.

    To configure logging to a Syslog server or FortiAnalyzer unit
    1. Go to Log & Report > Log Setting > Remote.
    2. Click New to create a new entry or double-click an existing entry to modify it.
    3. A dialog appears.

    4. Select Enable to allow logging to a remote host.
    5. Enter a Name.
    6. In Server name/IP, enter the IP address of the Syslog server or FortiAnalyzer unit where the FortiMail unit will store the logs.
    7. In Port, if the remote host is a FortiAnalyzer unit, enter 514; if the remote host is a Syslog server, enter the UDP port number on which the Syslog server listens for connections (by default, UDP 514).
    8. From Level, select the severity level that a log message must equal or exceed in order to be recorded to this storage location.
    9. For information about severity levels, see Log message severity levels.

    10. From Facility, select the facility identifier that the FortiMail unit will use to identify itself when sending log messages.
    11. To easily identify log messages from the FortiMail unit when they are stored on a remote logging server, enter a unique facility identifier, and verify that no other network devices use the same facility identifier.

    12. Enable CSV format if you want to send log messages in comma-separated value (CSV) format.
    13. Note

      Do not enable this option if the remote host is a FortiAnalyzer unit. FortiAnalyzer units do not support CSV-formatted log messages.

    14. From Log protocol, select Syslog if you want send logs to a Syslog server (including FortiAnalyzer). Select OFTPS if you want to use this secure protocol to send logs to FortiAnalyzer. Also specify the Hash algorithm for OFTPS. Note that FortiAnalyzer supports both Syslog and OFTPS.
    15. If you enabled advanced MTA control (see Configuring advanced MTA control settings), the Matched session only option appears. Select this option if you want to send only the matched session logs to the remote server. Otherwise, all logs will be sent.
    16. In Logging Policy Configuration, enable the types of logs you want to record to this storage location. Click the arrow to review the options.
    17. Click Create.
    18. If the remote host is a FortiAnalyzer unit, confirm with the FortiAnalyzer administrator that the FortiMail unit was added to the FortiAnalyzer unit’s device list, allocated sufficient disk space quota, and assigned permission to transmit logs to the FortiAnalyzer unit. For details, see the FortiAnalyzer Administration Guide.
    19. To verify logging connectivity, from the FortiMail unit, trigger a log message that matches the types and severity levels that you have chosen to store on the remote host. Then, on the remote host, confirm that it has received that log message.
    20. For example, if you have chosen to record event log messages to the remote host if they are more severe than information, you could log in to the web UI or download a backup copy of the FortiMail unit’s configuration file in order to trigger an event log message.

      If the remote host does not receive the log messages, verify the FortiMail unit’s network interfaces (see Configuring the network interfaces and About the management IP) and static routes (see Configuring static routes ), and the policies on any intermediary firewalls or routers. If ICMP ECHO (ping) is enabled on the remote host, you can use the execute traceroute command to determine the point where connectivity fails. For details, see the FortiMail CLI Reference.

    See also

    Log message severity levels

    Configuring logging to the hard disk

    Downloading log files

    You can download log files to your management computer. Downloading log files can be useful if you want to view log messages on your management computer, or if you want to download a backup copy of log files to another location before deleting them from the FortiMail unit’s hard disk.

    To download a log file
    1. Go to Monitor > Log.
    2. Click a log type tab, such as History.
    3. Select the row(s) corresponding to the log file(s) that you want to download and click Export > Export Selected. You can select multiple non-contiguous rows by holding Ctrl while selecting the log files.
    4. The log file downloads in comma-separated value (CSV) format with a file extension of .csv. You can view this format in a spreadsheet application such as Microsoft Excel.

    5. If your web browser prompts you for the location to save the file, browse to select or enter the name of the folder.
    To download all log files
    1. Go to Monitor > Log.
    2. Click a log type tab.
    3. Click Export > Export All.
    4. The log file downloads in comma-separated value (CSV) format with a file extension of .csv.

    5. If your web browser prompts you for the location to save the file, browse to select or enter the name of the folder.
    See also

    Configuring logging

    Viewing log messages

    Emptying the current log file

    You can empty the current log file to remove all of the log messages contained in that file, without deleting the log file itself.

    This can be useful in cases such as when you want to delete all old log messages from the FortiMail unit’s hard disk, because rolled log files can be deleted but the current log file cannot.

    Note

    Only the current log file can be emptied. Rolled log files cannot be emptied, but may be deleted instead. For more information, see Deleting rolled log files.

    Caution

    Back up the current log file before emptying the current log file. When emptying the log file, log messages are permanently removed, and cannot be recovered. For instructions on how to download a backup copy of the current log file, see Downloading log files.

    To empty the current log file
    1. Go to Monitor > Log.
    2. Click a log type tab, such as History.
    3. In the row corresponding to the current log file, click Empty Log.
    4. A confirmation dialog appears, such as:

      Are you sure you want to delete: alog?

    5. Click OK.
    See also

    Configuring logging

    Viewing log messages

    Deleting rolled log files

    You can delete rolled log files. This can be useful if you want to free disk space used by old log files to make disk space available for newer log files.

    Note

    Only rolled log files can be deleted. Current log files cannot be deleted, but may be emptied instead. For more information, see Emptying the current log file.

    Caution

    Back up the current log file before deleting a log file. When deleting a log file, log messages are permanently removed, and cannot be recovered. For instructions on how to download a backup copy of a log file, see Downloading log files.

    To delete a rolled log file
    1. Go to Monitor > Log.
    2. Click a log type tab, such as History.
    3. In the Action column, in the row corresponding to the log file that you want to delete, click Delete.
    4. A confirmation dialog appears, such as:

      Are you sure you want to delete: 2008-06-16-14:45:15_2007-10-16-22:52:20.alog?

    5. Click OK.
    To delete multiple rolled log files
    1. Go to Monitor > Log.
    2. Click a log type tab, such as History.
    3. If you want to delete selected log files, mark the checkbox in each row corresponding to a log file that you want to delete.
    4. If you want to delete all rolled log files, mark the checkbox in the column heading for the column that contains checkboxes. This automatically marks all other checkboxes.
    5. Click Delete Selected Items.
    6. A dialog appears:

      Are you sure you want to delete: selected log files?

    7. Click OK.
    See also

    Viewing log messages

    Configuring logging

    Configuring logging

    The Log Setting submenu includes two tabs, Local and Remote, that let you:

    • set the severity level
    • configure which types of log messages to record
    • specify where to store the logs

    You can configure the FortiMail unit to store log messages locally (that is, in RAM or to the hard disk), remotely (that is, on a Syslog server or FortiAnalyzer unit), or at both locations.

    Your choice of storage location may be affected by several factors, including the following:

    • Local logging by itself may not satisfy your requirements for off-site log storage.
    • Very frequent logging may cause undue wear when stored on the local hard drive. A low severity threshold is one possible cause of frequent logging. For more information on severity levels, see Log message severity levels.

    For information on viewing locally stored log messages, see Viewing log messages.

    See also

    Configuring logging to a Syslog server or FortiAnalyzer unit

    Configuring logging to the hard disk

    Configuring logging to the hard disk

    You can store log messages locally on the hard disk of the FortiMail unit.

    To ensure that local hard disk has sufficient disk space to store new log messages and that it does not overwrite existing logs, you should regularly download backup copies of the oldest log files to your management computer or other storage, and then delete them from the FortiMail unit (alternatively, you could configure logging to a remote host).

    You can view and download these logs from the Log submenu of the Monitor tab. For more information, see Viewing log messages.

    For logging accuracy, you should also verify that the FortiMail unit’s system time is accurate. For details, see Configuring the time and date.

    To access this part of the web UI, your administrator account’s:

    • Domain must be System
    • access profile must have Read or Read-Write permission to the Others category

    For details, see About administrator account permissions and domains.

    To configure logging to the local hard disk
    1. Go to Log & Report > Log Setting > Local.
    2. Select the Enable option to allow logging to the local hard disk.
    3. In Log file size, enter the file size limit of the current log file in megabytes (MB).
    4. In Log time, enter the time (in days) of file age limit. Valid range is between 1 and 365 days.
    5. In At hour, enter the hour of the day (24-hour format) when the file rotation should start.
    6. When a log file reaches either the age or size limit, the FortiMail unit rotates the current log file: that is, it renames the current log file (elog.log) with a file name indicating its sequential relationship to other log files of that type (elog2.log, and so on), then creates a new current log file. For example, if you set the log time to 10 days at hour 23, the log file will be rotated at 23rd hour of the 10th day (23:00).

      Note

      Large log files may decrease display and search performance.

    7. From Log level, select the severity level that a log message must equal or exceed in order to be recorded to this storage location.
    8. Caution

      Avoid recording log messages using low severity thresholds such as Information or Notification to the local hard disk for an extended period of time. A low log severity threshold is one possible cause of frequent logging. Excessive logging frequency can cause undue wear on the hard disk and may cause premature failure.

      For information about severity levels, see Log message severity levels.

    9. For Log retention period, specify how long (in days) the logs will be kept. Valid range is 0 to 1461 days. 0 means no limit.
    10. From Log options when disk is full, select what you want to do when the log partition of the local disk is almost full, meaning that less than 5 percent of the disk space or 1.5 GB, whichever is smaller, is left.
    • Do not log: Discard all new log messages.
    • Overwrite: Delete the oldest log file in order to free disk space, and store the new log messages. Oldest files of all log types will be deleted until 15 percent of the disk space or 22.5 GB, whichever is smaller, is reached.
  • In Logging Policy Configuration, enable the types of logs that you want to record to this storage location. Click the arrow to review the options.
  • Click Apply.
  • See also

    Log message severity levels

    Configuring logging to a Syslog server or FortiAnalyzer unit

    Instead of or in addition to logging locally, you can store log messages remotely on a Syslog server or a FortiAnalyzer unit. For information about how many remote Syslog servers your FortiMail model can support, see Appendix B: Maximum Values.

    Note

    Logs stored remotely cannot be viewed from the web UI of the FortiMail unit. If you require the ability to view logs from the web UI, also enable local storage. For details, see Configuring logging to the hard disk.

    Before you can log to a remote location, you must first enable logging. For logging accuracy, you should also verify that the FortiMail unit’s system time is accurate. For details, see Configuring the time and date.

    To access this part of the web UI, your administrator account’s:

    • Domain must be System
    • access profile must have Read or Read-Write permission to the Others category

    For details, see About administrator account permissions and domains.

    To configure logging to a Syslog server or FortiAnalyzer unit
    1. Go to Log & Report > Log Setting > Remote.
    2. Click New to create a new entry or double-click an existing entry to modify it.
    3. A dialog appears.

    4. Select Enable to allow logging to a remote host.
    5. Enter a Name.
    6. In Server name/IP, enter the IP address of the Syslog server or FortiAnalyzer unit where the FortiMail unit will store the logs.
    7. In Port, if the remote host is a FortiAnalyzer unit, enter 514; if the remote host is a Syslog server, enter the UDP port number on which the Syslog server listens for connections (by default, UDP 514).
    8. From Level, select the severity level that a log message must equal or exceed in order to be recorded to this storage location.
    9. For information about severity levels, see Log message severity levels.

    10. From Facility, select the facility identifier that the FortiMail unit will use to identify itself when sending log messages.
    11. To easily identify log messages from the FortiMail unit when they are stored on a remote logging server, enter a unique facility identifier, and verify that no other network devices use the same facility identifier.

    12. Enable CSV format if you want to send log messages in comma-separated value (CSV) format.
    13. Note

      Do not enable this option if the remote host is a FortiAnalyzer unit. FortiAnalyzer units do not support CSV-formatted log messages.

    14. From Log protocol, select Syslog if you want send logs to a Syslog server (including FortiAnalyzer). Select OFTPS if you want to use this secure protocol to send logs to FortiAnalyzer. Also specify the Hash algorithm for OFTPS. Note that FortiAnalyzer supports both Syslog and OFTPS.
    15. If you enabled advanced MTA control (see Configuring advanced MTA control settings), the Matched session only option appears. Select this option if you want to send only the matched session logs to the remote server. Otherwise, all logs will be sent.
    16. In Logging Policy Configuration, enable the types of logs you want to record to this storage location. Click the arrow to review the options.
    17. Click Create.
    18. If the remote host is a FortiAnalyzer unit, confirm with the FortiAnalyzer administrator that the FortiMail unit was added to the FortiAnalyzer unit’s device list, allocated sufficient disk space quota, and assigned permission to transmit logs to the FortiAnalyzer unit. For details, see the FortiAnalyzer Administration Guide.
    19. To verify logging connectivity, from the FortiMail unit, trigger a log message that matches the types and severity levels that you have chosen to store on the remote host. Then, on the remote host, confirm that it has received that log message.
    20. For example, if you have chosen to record event log messages to the remote host if they are more severe than information, you could log in to the web UI or download a backup copy of the FortiMail unit’s configuration file in order to trigger an event log message.

      If the remote host does not receive the log messages, verify the FortiMail unit’s network interfaces (see Configuring the network interfaces and About the management IP) and static routes (see Configuring static routes ), and the policies on any intermediary firewalls or routers. If ICMP ECHO (ping) is enabled on the remote host, you can use the execute traceroute command to determine the point where connectivity fails. For details, see the FortiMail CLI Reference.

    See also

    Log message severity levels

    Configuring logging to the hard disk

    Downloading log files

    You can download log files to your management computer. Downloading log files can be useful if you want to view log messages on your management computer, or if you want to download a backup copy of log files to another location before deleting them from the FortiMail unit’s hard disk.

    To download a log file
    1. Go to Monitor > Log.
    2. Click a log type tab, such as History.
    3. Select the row(s) corresponding to the log file(s) that you want to download and click Export > Export Selected. You can select multiple non-contiguous rows by holding Ctrl while selecting the log files.
    4. The log file downloads in comma-separated value (CSV) format with a file extension of .csv. You can view this format in a spreadsheet application such as Microsoft Excel.

    5. If your web browser prompts you for the location to save the file, browse to select or enter the name of the folder.
    To download all log files
    1. Go to Monitor > Log.
    2. Click a log type tab.
    3. Click Export > Export All.
    4. The log file downloads in comma-separated value (CSV) format with a file extension of .csv.

    5. If your web browser prompts you for the location to save the file, browse to select or enter the name of the folder.
    See also

    Configuring logging

    Viewing log messages

    Emptying the current log file

    You can empty the current log file to remove all of the log messages contained in that file, without deleting the log file itself.

    This can be useful in cases such as when you want to delete all old log messages from the FortiMail unit’s hard disk, because rolled log files can be deleted but the current log file cannot.

    Note

    Only the current log file can be emptied. Rolled log files cannot be emptied, but may be deleted instead. For more information, see Deleting rolled log files.

    Caution

    Back up the current log file before emptying the current log file. When emptying the log file, log messages are permanently removed, and cannot be recovered. For instructions on how to download a backup copy of the current log file, see Downloading log files.

    To empty the current log file
    1. Go to Monitor > Log.
    2. Click a log type tab, such as History.
    3. In the row corresponding to the current log file, click Empty Log.
    4. A confirmation dialog appears, such as:

      Are you sure you want to delete: alog?

    5. Click OK.
    See also

    Configuring logging

    Viewing log messages

    Deleting rolled log files

    You can delete rolled log files. This can be useful if you want to free disk space used by old log files to make disk space available for newer log files.

    Note

    Only rolled log files can be deleted. Current log files cannot be deleted, but may be emptied instead. For more information, see Emptying the current log file.

    Caution

    Back up the current log file before deleting a log file. When deleting a log file, log messages are permanently removed, and cannot be recovered. For instructions on how to download a backup copy of a log file, see Downloading log files.

    To delete a rolled log file
    1. Go to Monitor > Log.
    2. Click a log type tab, such as History.
    3. In the Action column, in the row corresponding to the log file that you want to delete, click Delete.
    4. A confirmation dialog appears, such as:

      Are you sure you want to delete: 2008-06-16-14:45:15_2007-10-16-22:52:20.alog?

    5. Click OK.
    To delete multiple rolled log files
    1. Go to Monitor > Log.
    2. Click a log type tab, such as History.
    3. If you want to delete selected log files, mark the checkbox in each row corresponding to a log file that you want to delete.
    4. If you want to delete all rolled log files, mark the checkbox in the column heading for the column that contains checkboxes. This automatically marks all other checkboxes.
    5. Click Delete Selected Items.
    6. A dialog appears:

      Are you sure you want to delete: selected log files?

    7. Click OK.
    See also

    Viewing log messages

    Configuring logging