Qpsmtpd:logging

From SME Server
Revision as of 12:04, 18 July 2017 by Mmccarn (talk | contribs) (Created page with "SME server uses the logging/logterse plugin to generate a single-line summary of each transaction. <span id="_top">Qpsmtpd#Plugins</span> <!-- Generated Tue Jul 18 07:00...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

SME server uses the logging/logterse plugin to generate a single-line summary of each transaction.

Qpsmtpd#Plugins


[root@office ~]# less /usr/share/qpsmtpd/plugins/logging/ [root@office ~]# grep -ril logging /var/service/qpsmtpd/config/* /var/service/qpsmtpd/config/peers/local /var/service/qpsmtpd/config/peers/0 [root@office ~]# less /var/service/qpsmtpd/config/peers/0 [root@office ~]# grep logging /etc/e-smith/templates/var/service/qpsmtpd/* grep: /etc/e-smith/templates/var/service/qpsmtpd/config: Is a directory grep: /etc/e-smith/templates/var/service/qpsmtpd/peers: Is a directory grep: /etc/e-smith/templates/var/service/qpsmtpd/runenv: Is a directory [root@office ~]# grep -riH logging /etc/e-smith/templates/var/service/qpsmtpd/* /etc/e-smith/templates/var/service/qpsmtpd/config/plugins/02logterse:logging/logterse [root@office ~]# qpdoc.sh logging/logterse


Qpsmtpd#Plugins

SYNOPSIS

logterse [prefix char] [loglevel level]

This plugin is not a logging replacement, but rather an adjunct to the normal logging plugins or builtin logging functionality. Specify it in config/plugins not config/logging or you'll get "interesting" results.

The idea is to produce a one-line log entry that summarises the outcome of a transaction. A message is either queued or rejected (bizarre failure modes are not of interest). What is of interest is the details of the sending host and the message envelope, and what happened to the message. To do this we hook_deny and hook_queue and grab as much info as we can.

This info is then passed to the real logging subsystem as a single line with colon-separated fields as follows:

1. remote ip

2. remote hostname

3. helo host

4. envelope sender

5. recipient (comma-separated list if more than one)

6. name of plugin that called DENY, or the string 'queued' if message was accepted.

7. return value of DENY plugin (empty if message was queued).

8. the DENY message, or the message-id if it was queued.

9. details of spammassassin scores if messaged was accepted or denied due to score requiring rejection or 'msg denied before queued' if other rejections occur.

As with logging/adaptive, a distinctive prefix (the backquote character by default) is used to make it easy to extract the lines from the main logfiles, or to take advantage of multilog's selection capability as described in the logging/adaptive plugin:

TYPICAL USAGE

If you are using multilog to handle your logging, you can replace the system provided log/run file with something like this:

  #! /bin/sh
  export LOGDIR=./main
  
  exec multilog t n10 \
    $LOGDIR \
    '-*' '+*` *' $LOGDIR/summary

which will have the following effects:

1. All lines will be logged in ./main as usual.

2. ./main/summary will contain only the lines output by this plugin.

AUTHORS

Written by Charles Butcher who took a lot from logging/adaptive by John Peacock.

Added to by Brian Read (March 2007) to add in the spamassassin scores.

VERSION

This is release 1.1