/[smeserver]/rpms/smeserver-qpsmtpd/sme8/smeserver-qpsmtpd-1.2.1-logterse.patch
ViewVC logotype

Annotation of /rpms/smeserver-qpsmtpd/sme8/smeserver-qpsmtpd-1.2.1-logterse.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (hide annotations) (download)
Tue Oct 7 15:06:54 2008 UTC (15 years, 8 months ago) by slords
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +0 -0 lines
FILE REMOVED
New streams

1 slords 1.1 diff -Nur -x '*.orig' -x '*.rej' smeserver-qpsmtpd-1.2.1/root/etc/e-smith/db/configuration/defaults/qpsmtpd/LogLevel mezzanine_patched_smeserver-qpsmtpd-1.2.1/root/etc/e-smith/db/configuration/defaults/qpsmtpd/LogLevel
2     --- smeserver-qpsmtpd-1.2.1/root/etc/e-smith/db/configuration/defaults/qpsmtpd/LogLevel 2006-06-30 17:08:07.000000000 -0600
3     +++ mezzanine_patched_smeserver-qpsmtpd-1.2.1/root/etc/e-smith/db/configuration/defaults/qpsmtpd/LogLevel 2007-04-10 08:43:31.000000000 -0600
4     @@ -1 +1 @@
5     -8
6     +6
7     diff -Nur -x '*.orig' -x '*.rej' smeserver-qpsmtpd-1.2.1/root/etc/e-smith/templates/var/service/qpsmtpd/config/plugins/02logterse mezzanine_patched_smeserver-qpsmtpd-1.2.1/root/etc/e-smith/templates/var/service/qpsmtpd/config/plugins/02logterse
8     --- smeserver-qpsmtpd-1.2.1/root/etc/e-smith/templates/var/service/qpsmtpd/config/plugins/02logterse 1969-12-31 17:00:00.000000000 -0700
9     +++ mezzanine_patched_smeserver-qpsmtpd-1.2.1/root/etc/e-smith/templates/var/service/qpsmtpd/config/plugins/02logterse 2007-04-10 08:45:28.000000000 -0600
10     @@ -0,0 +1 @@
11     +logging/logterse
12     diff -Nur -x '*.orig' -x '*.rej' smeserver-qpsmtpd-1.2.1/root/usr/share/qpsmtpd/plugins/logging/logterse mezzanine_patched_smeserver-qpsmtpd-1.2.1/root/usr/share/qpsmtpd/plugins/logging/logterse
13     --- smeserver-qpsmtpd-1.2.1/root/usr/share/qpsmtpd/plugins/logging/logterse 1969-12-31 17:00:00.000000000 -0700
14     +++ mezzanine_patched_smeserver-qpsmtpd-1.2.1/root/usr/share/qpsmtpd/plugins/logging/logterse 2007-04-10 08:43:04.000000000 -0600
15     @@ -0,0 +1,172 @@
16     +=pod
17     +
18     +=head1 SYNOPSIS
19     +
20     +logterse [prefix char] [loglevel level]
21     +
22     +This plugin is not a logging replacement, but rather an adjunct to the normal logging
23     +plugins or builtin logging functionality. Specify it in config/plugins not
24     +config/logging or you'll get "interesting" results.
25     +
26     +The idea is to produce a one-line log entry that summarises the outcome of a
27     +transaction. A message is either queued or rejected (bizarre failure modes are
28     +not of interest). What is of interest is the details of the sending host and the
29     +message envelope, and what happened to the message. To do this we hook_deny and
30     +hook_queue and grab as much info as we can.
31     +
32     +This info is then passed to the real logging subsystem as a single line with
33     +colon-separated fields as follows:
34     +
35     +=over 4
36     +
37     +=item 1. remote ip
38     +
39     +=item 2. remote hostname
40     +
41     +=item 3. helo host
42     +
43     +=item 4. envelope sender
44     +
45     +=item 5. recipient (comma-separated list if more than one)
46     +
47     +=item 6. name of plugin that called DENY, or the string 'queued' if message was accepted.
48     +
49     +=item 7. return value of DENY plugin (empty if message was queued).
50     +
51     +=item 8. the DENY message, or the message-id if it was queued.
52     +
53     +=item 9. details of spammassassin scores if messaged was accepted or denied due to score requiring rejection
54     + or 'msg denied before queued' if other rejections occur.
55     +
56     +
57     +=back
58     +
59     +As with logging/adaptive, a distinctive prefix (the backquote character by default) is
60     +used to make it easy to extract the lines from the main logfiles, or to take advantage
61     +of multilog's selection capability as described in the logging/adaptive plugin:
62     +
63     +=head1 TYPICAL USAGE
64     +
65     +If you are using multilog to handle your logging, you can replace the system
66     +provided log/run file with something like this:
67     +
68     + #! /bin/sh
69     + export LOGDIR=./main
70     +
71     + exec multilog t n10 \
72     + $LOGDIR \
73     + '-*' '+*` *' $LOGDIR/summary
74     +
75     +which will have the following effects:
76     +
77     +=over 4
78     +
79     +=item 1. All lines will be logged in ./main as usual.
80     +
81     +=item 2. ./main/summary will contain only the lines output by this plugin.
82     +
83     +=back
84     +
85     +
86     +=head1 AUTHORS
87     +
88     +Written by Charles Butcher who took a lot from logging/adaptive by John Peacock.
89     +
90     +Added to by Brian Read (March 2007) to add in the spamassassin scores.
91     +
92     +=head1 VERSION
93     +
94     +This is release 1.1
95     +
96     +=cut
97     +
98     +#
99     +# I chose tab as the field separator to help with human-readability of the logs and hopefully minimal
100     +# chance of a tab showing up _inside_ a field (although they are converted if they do).
101     +# If you change it here, remember to change it in qplogsumm.pl as well.
102     +#
103     +my $FS = "\t";
104     +#my $FS = "\&";
105     +
106     +sub register {
107     + my ( $self, $qp, %args ) = @_;
108     +
109     + $self->{_prefix} = '`';
110     + if ( defined $args{prefix} and $args{prefix} =~ /^(.+)$/ ) {
111     + $self->{_prefix} = $1;
112     + }
113     +
114     + $self->{_loglevel} = LOGALERT;
115     + if ( defined( $args{loglevel} ) ) {
116     + if ( $args{loglevel} =~ /^\d+$/ ) {
117     + $self->{_loglevel} = $args{loglevel};
118     + }
119     + else {
120     + $self->{_loglevel} = log_level( $args{loglevel} );
121     + }
122     + }
123     +}
124     +
125     +
126     +sub hook_deny {
127     + my ( $self, $transaction, $prev_hook, $retval, $return_text ) = @_;
128     +
129     + my $disposition = join($FS,
130     + $prev_hook,
131     + $retval,
132     + $return_text,
133     + );
134     +
135     + $self->_log_terse($transaction, $disposition);
136     + return DECLINED;
137     +}
138     +
139     +sub hook_queue {
140     + my ( $self, $transaction ) = @_;
141     +
142     + my $msg_id = $transaction->header->get('Message-Id') || '';
143     + $msg_id =~ s/[\r\n].*//s; # don't allow newlines in the Message-Id here
144     + $msg_id = "<$msg_id>" unless $msg_id =~ /^<.*>$/; # surround in <>'s
145     + my $disposition = "queued$FS$FS$msg_id";
146     +
147     + $self->_log_terse($transaction, $disposition);
148     + return DECLINED;
149     +}
150     +
151     +sub _log_terse {
152     + my ( $self, $transaction, $disposition ) = @_;
153     +
154     + my $recipients = join(',', $transaction->recipients);
155     +
156     + my $remote_ip = $self->qp->connection->remote_ip() || '';
157     + my $remote_host = $self->qp->connection->remote_host() || '';
158     + my $hello_host = $self->qp->connection->hello_host() || '';
159     + my $tx_sender = $transaction->sender() || '';
160     + my $spamscore = 'msg denied before queued';
161     + if (substr($disposition,0,6) =~ 'queued|spamas') {
162     + $spamscore = $transaction->header->get('X-Spam-Status') || '';
163     + # just pull out scores
164     + $spamscore = substr($spamscore,0,index($spamscore,'tests')-1);
165     + map(s/\n/_/g,$spamscore)
166     + }
167     +
168     + my @log_message;
169     +
170     + push(@log_message,
171     + $remote_ip,
172     + $remote_host,
173     + $hello_host,
174     + $tx_sender,
175     + $recipients
176     + );
177     +
178     + #
179     + # Escape any $FS characters anywhere in the log message
180     + #
181     + map {s/$FS/_/g} @log_message;
182     +
183     + push(@log_message, $disposition);
184     + push(@log_message, $spamscore);
185     +
186     + $self->log($self->{_loglevel}, $self->{_prefix}, join($FS, @log_message));
187     +}

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed