Installing and Administering Internet Services
66 Chapter2
Installing and Configuring Internet Services
Troubleshooting sendmail
present. This ID uniquely identifies a message and can
be used to trace the progress of a message through mail
relays.
from= The sender of the message and the message size are
logged.
to= The recipient of the message. One message may have
multiple recipients. sendmail logs a separate entry for
each separate delivery attempt it makes, so multiple
recipients on the same host may appear on the same
line, but multiple recipients on different hosts will
appear on different lines. The delivery status of the
message (whether message succeeded, failed, or was
queued), the mailer, and the host used are logged.
Queued messages and SYSERRs are also logged.
Storing Off Old sendmail Log Files
At typical logging levels, every piece of mail passing through sendmail
adds two or three lines to the mail log. A script to manage the growth of
the mail log could be run nightly, at midnight, with an entry in root’s
crontab file. Following is an example of a crontab entry for a script
called newsyslog:
0 0 * * * /var/adm/syslog/newsyslog
The following example shows what the script
/var/adm/syslog/newsyslog might contain. The script assumes that
syslog is configured to direct mail logging to
/var/adm/syslog/mail.log.
#!/usr/bin/sh
#
# NEWSYSLOG: save only the last week’s sendmail logging
#
cd /var/adm/syslog
mv mail.log.6 mail.log.7
mv mail.log.5 mail.log.6
mv mail.log.4 mail.log.5
mv mail.log.3 mail.log.4
mv mail.log.2 mail.log.3
mv mail.log.1 mail.log.2
cp mail.log mail.log.1