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.
When the following system resource usages exceed the predefined thresholds, the events will be logged.
|
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 configure logging to the local hard disk
- Go to Log & Report > Log Setting > Local.
- Select the Enable option to allow logging to the local hard disk.
- In Log file size, enter the file size limit of the current log file in megabytes (MB).
- In Log time, enter the time (in days) of file age limit. Valid range is between 1 and 365 days.
- In At hour, enter the hour of the day (24-hour format) when the file rotation should start.
- From Log level, select the severity level that a log message must equal or exceed in order to be recorded to this storage location.
- 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.
- 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.
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).
Large log files may decrease display and search performance. |
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.
- 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.
See also
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.
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 configure logging to a Syslog server or FortiAnalyzer unit
- Go to Log & Report > Log Setting > Remote.
- Click New to create a new entry or double-click an existing entry to modify it.
- Select Enable to allow logging to a remote host.
- Enter a Name.
- In Server name/IP, enter the IP address of the Syslog server or FortiAnalyzer unit where the FortiMail unit will store the logs.
- 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). - From Level, select the severity level that a log message must equal or exceed in order to be recorded to this storage location.
- From Facility, select the facility identifier that the FortiMail unit will use to identify itself when sending log messages.
- Enable CSV format if you want to send log messages in comma-separated value (CSV) format.
- 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.
- 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.
- In Logging Policy Configuration, enable the types of logs you want to record to this storage location. Click the arrow to review the options.
- Click Create.
- 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.
- 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.
A dialog appears.
For information about severity levels, see Log message severity levels.
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.
Do not enable this option if the remote host is a FortiAnalyzer unit. FortiAnalyzer units do not support CSV-formatted log messages. |
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
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
- Go to Monitor > Log.
- Click a log type tab, such as History.
- 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.
- If your web browser prompts you for the location to save the file, browse to select or enter the name of the folder.
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.
To download all log files
- Go to Monitor > Log.
- Click a log type tab.
- Click Export > Export All.
- If your web browser prompts you for the location to save the file, browse to select or enter the name of the folder.
The log file downloads in comma-separated value (CSV) format with a file extension of .csv.
See also
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.
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. |
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
- Go to Monitor > Log.
- Click a log type tab, such as History.
- In the row corresponding to the current log file, click Empty Log.
- Click OK.
A confirmation dialog appears, such as:
Are you sure you want to delete: alog?
See also
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.
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. |
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
- Go to Monitor > Log.
- Click a log type tab, such as History.
- In the Action column, in the row corresponding to the log file that you want to delete, click Delete.
- Click OK.
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?
To delete multiple rolled log files
- Go to Monitor > Log.
- Click a log type tab, such as History.
- If you want to delete selected log files, mark the checkbox in each row corresponding to a log file that you want to delete.
- 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.
- Click Delete Selected Items.
- Click OK.
A dialog appears:
Are you sure you want to delete: selected log files?