Home arrow Site Administration arrow Page 13 - Getting Started with Sendmail

1.10 Logging sendmail - Administration

If you want to build or customize a sendmail configuration, you need to know your way around the sendmail distribution. This article will help you find your way around the cf directory, which contains the configuration files. It was excerpted from chapter one of The Sendmail Cookbook, written by Craig Hunt (O'Reilly Media, 2004; ISBN: 0596004710).

TABLE OF CONTENTS:
  1. Getting Started with Sendmail
  2. The cf directory structure
  3. The cf/m4 directory
  4. 1.1 Downloading the Latest Release
  5. 1.2 Installing sendmail
  6. 1.3 Compiling sendmail to Use LDAP
  7. 1.4 Adding the regex Map Type to sendmail
  8. 1.5 Compiling sendmail with SASL Support
  9. 1.6 Compiling sendmail with STARTTLS Support
  10. 1.7 Compiling in STARTTLS File Paths
  11. 1.8 Building a sendmail Configuration
  12. 1.9 Testing a New Configuration
  13. 1.10 Logging sendmail
By: O'Reilly Media
Rating: starstarstarstarstar / 26
July 07, 2005

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

Problem

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
  # Log anything (except mail) of level info or higher.   
  * .info;mail.none;authpriv.none;cron.none
/var/log/messages
  # Log all the mail messages in one place.  
  mail.*                               /var/log/maillog

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:

0

Log a limited number of severe problems, such as failing to find the system's hostname or qualified domain name.

1

Log serious system failures using syslog crit and alert levels.

2

Log networking failures at crit level

3

Log connection timeouts, malformed addresses, and forward and include errors using notice and error syslog levels.

4

Log connection rejections, bad qf filenames, and outdated aliases databases using info and notice levels.

5

Log envelope cloning, and log an entry for each message received. These log entries are made at the syslog info level.

6

Log a record of each message returned to the original sender, and log incoming SMTP VRFY, EXPN, and ETRN commands using the info level

7

Log delivery failures at the info level.

8

Log successful deliveries and alias database rebuilds at the syslog notice level.

9

Log mail deferred because of lack of system resources at the info level.

10

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.

11

Log end of processing, and log NIS errors. Log both types of messages at info level.

12

Log outbound SMTP connections at info level.

13

Log questionable file security, such as world-writable files and bad user shells.

14

Log connection refusals. Log additional STARTTLS information. Log both types of messages at info level.

15

Log all incoming SMTP commands at info level.

16–98

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:

  define(`confLOG_Level', `14')

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.

See Also

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 
   version level. In our examples, the sendmail version number is .12.9, 
   but the sendmail.cf version level is 10. Furthermore, neither one
   of these has anything to do with the m4 VERSIONID macro, which  
   is used to place version control information in the master 
   configuration file.

* If you use RPM, the rpmfind.net web site can help you search for 
   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.



 
 
>>> More Site Administration Articles          >>> More By O'Reilly Media
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

SITE ADMINISTRATION ARTICLES

- Coding: Not Just for Developers
- To Support or Not Support IE?
- Administration: Networking OSX and Win 7
- DotNetNuke Gets Social
- Integrating MailChimp with Joomla: Creating ...
- Integrating MailChimp with Joomla: List Mana...
- Integrating MailChimp with Joomla: Building ...
- Integrating MailChimp with Joomla
- More Top WordPress Plugins for Social Media
- Optimizing Security: SSH Public Key Authenti...
- Patches and Rejects in Software Configuratio...
- Configuring a CVS Server
- Managing Code and Teams for Cross-Platform S...
- Software Configuration Management
- Back Up a Joomla Site with Akeeba Backup

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: