Debugging a problem in the sendmail configuration may require more detailed information than sendmail logs by default.Solution
Use the LogLevel option, either on the sendmail command line using the -O flag or in the sendmail configuration using the confLOG_LEVEL define, to increase the LogLevel above the default level of 9.
If the confLOG_LEVEL define is used, rebuild and reinstall sendmail.cf, and restart sendmail, as described in Recipe 1.8.Discussion
sendmail logs messages through syslog using the mail facility. Where the messages are logged is determined by the syslog.conf file. A grep of syslog.conf shows where the sendmail messages are logged on our sample Linux system:
$ grep mail /etc/syslog.conf
Disregarding the comments, there are two lines in this particular syslog.conf file that mention the mail facility. The first line has a wildcard character in the facility field, meaning that it applies to every syslog facility. At first glance, you might think this applies to sendmail messages until you notice mail.none, which means that no messages from the mail facility will be logged in /var/log/messages./var/log/maillog is the place to look for sendmail log entries on this sample Linux system. The mail.* entry means that, no matter what the level, all messages from the mail facility are logged in /var/log/maillog. Of course, this syslog.conf file is specific to our sample system. Your file might look different and, even if it looks exactly like this one, you can change it in anyway that you wish. You completely control where sendmail logs messages.
The syslog.conf file controls where sendmail messages are logged. The sendmail LogLevel option controls what is logged. The default sendmail LogLevel is 9, which is roughly equivalent to the syslog level info. Increasing the value of LogLevel increases the amount of data that sendmail logs. The meaningful LogLevel values are:
Log a limited number of severe problems, such as failing to find the system's hostname or qualified domain name.
Log serious system failures using syslog crit and alert levels.
Log networking failures at crit level
Log connection timeouts, malformed addresses, and forward and include errors using notice and error syslog levels.
Log connection rejections, bad qf filenames, and outdated aliases databases using info and notice levels.
Log envelope cloning, and log an entry for each message received. These log entries are made at the syslog info level.
Log a record of each message returned to the original sender, and log incoming SMTP VRFY, EXPN, and ETRN commands using the info level
Log delivery failures at the info level.
Log successful deliveries and alias database rebuilds at the syslog notice level.
Log mail deferred because of lack of system resources at the info level.
Log inbound SMTP connections and MILTER connects and replies. Log each database lookup. Log AUTH and STARTTLS errors. All of these messages are logged at info level. Also log TLS errors at syslog warning level.
Log end of processing, and log NIS errors. Log both types of messages at info level.
Log outbound SMTP connections at info level.
Log questionable file security, such as world-writable files and bad user shells.
Log connection refusals. Log additional STARTTLS information. Log both types of messages at info level.
Log all incoming SMTP commands at info level.
Log debugging information at debug level. This data is mostly suitable for code developers.
Setting LogLevel causes all levels below the specified number to also be logged. Thus the default LogLevel of 9 also logs all of the messages described for levels 1 through 8. Each LogLevel adds more detail while continuing to log the messages of the lower LogLevel settings.
LogLevel can be set inside the sendmail configuration using the confLOG_LEVEL define. For example:
However, it is often only necessary to increase LogLevel for a short time or for a single test run. This can be done by defining LogLevel on the sendmail command line using the -O argument. Here is an example:
# sendmail –O LogLevel=14 –bs -Am
This example runs sendmail from the command line. The -Am argument, which does not apply to sendmail versions before 8.12, ensures that sendmail runs as an MTA— this argument is the opposite of the -Ac option discussed earlier in this chapter. The -bs argument allows you to manually input the SMTP commands in a manner similar to the telnet tests used in the previous recipe. The -O argument allows you to set the LogLevel from the command line. A command such as this might be used to log the effect of specific SMTP interactions.
Both techniques for setting LogLevel work well. The technique you use depends on the circumstances and your preference.
The sendmail book covers logging in section 14.3 and LogLevel in section 24.9.56.
* Most of the ls command output in this book is generated on a Red
Hat Linux system. Other versions of Unix and Linux may sort ls
output in a different way. The listing order may be different, but the
files and directories will be the same. * Recipe 10.10 shows a trick that is used to create a configuration
without using an OSTYPE macro, but the trick is not recommended
for general use.
* The sendmail version number is not the same as the sendmail.cf
RPM compatible packages. * In this example, the signature is used to verify the gzipped tar file.
Signing the compressed files started with Version 8.12.7. Earlier
versions of sendmail signed the uncompressed tar file. In those
cases, the tar file is first decompressed and then verified. * If you make changes to the siteconfig.m4 file and rerun Build,
use the -c command-line argument to alert Build of the changes.
* Recipe 10.1 shows a trick to get around this requirement.
blog comments powered by Disqus