Mail logging
The sendmail command logs mail system activity through the syslogd daemon.
The syslogd daemon must be configured and running for logging to occur. Specifically, the /etc/syslog.conf file should contain the uncommented line:
mail.debug /var/spool/mqueue/log
If it does not, use your favorite editor to make this change; be certain that the path name is correct. If you change the /etc/syslog.conf file while the syslogd daemon is running, refresh the syslogd daemon by typing the following command at a command line:
refresh -s syslogd
If the /var/spool/mqueue/log file does not exist, you must create it by typing the following command:
touch /var/spool/mqueue/log
Messages in the log file appear in the following format:
Each line in the system log consists of a time stamp, the name
of the machine that generated it (for logging from several machines
over the local area network), the word sendmail:
,
and a message. Most messages are a sequence of name=value pairs.
The two most common lines logged when a message is processed are the receipt line and the delivery attempt line. The receipt line logs the receipt of a message; there will be one of these per message. Some fields may be omitted. These message fields are:
Item | Description |
---|---|
from |
Specifies the envelope sender address. |
size |
Specifies the size of the message in bytes. |
class |
Indicates the class (numeric precedence) of the message. |
pri |
Specifies the initial message priority (used for queue sorting). |
nrcpts |
Indicates the number of envelope recipients for this message (after aliasing and forwarding). |
proto |
Specifies the protocol used to receive the message, for example ESMTP or UNIX-to-UNIX Copy Program (UUCP). |
relay |
Specifies the machine from which it was received. |
The delivery attempt line is logged each time there is delivery attempt (so there can be several per message if delivery is deferred or there are multiple recipients). These fields are:
Item | Description |
---|---|
to |
Contains a comma-separated list of the recipients to this mailer. |
ctladdr |
Specifies the controlling user, that is, the name of the user whose credentials are used for delivery. |
delay |
Specifies the total delay between the time this message was received and the time it was delivered. |
xdelay |
Specifies the amount of time needed in this delivery attempt. |
mailer |
Specifies the name of the mailer used to deliver to this recipient. |
relay |
Specifies the name of the host that actually accepted (or rejected) this recipient. |
stat |
Specifies the delivery status. |
Because such a large amount of information can be logged, the log file is arranged as a succession of levels. Beginning at level 1, the lowest level, only very unusual situations are logged. At the highest level, even the insignificant events are logged. As a convention, log levels ten and under the most useful information. Log levels above 64 are reserved for debugging purposes. Levels from 11-64 are reserved for verbose information.
The types of activities that the sendmail command puts into the log file are specified by the L option in the /etc/mail/sendmail.cf file.