You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@spamassassin.apache.org by sabat <sa...@eloan.com> on 2004/03/02 02:27:00 UTC
PATCH: spamd --log-msg-id Option
I had a need for spamd to log the SMTP msg id when it logs 'clean
message' or 'identified spam' to the syslog. Below is a patch to
spamd.raw (2.63) that adds a --log-msg-id option. Normally a log message
would look like
Mar 1 17:23:19 hostname spamd[26805]: identified spam (66.7/4.9) for
spamuser:702 in 1.4 seconds, 1217 bytes.
but with the --log-msg-id option on, it looks like this:
Mar 1 17:23:19 hostname spamd[26805]: identified spam
<d1...@hostname.com> (66.7/4.9) for
spamuser:702 in 1.4 seconds, 1217 bytes.
To me, it seems like the msg id should always be there, since it's there
when spamd announces that it's working on a message. But I didn't want
to break anything, so it's an option. :-)
Steve Abatangle
E-Loan, Inc.
--- spamd.raw.orig Mon Mar 1 16:34:54 2004
+++ spamd.raw Mon Mar 1 17:04:13 2004
@@ -122,6 +122,7 @@
'pidfile|r=s' => \$opt{'pidfile'},
'syslog|s=s' => \$opt{'syslog'},
'syslog-socket=s' => \$opt{'syslog-socket'},
+ 'log-msg-id' => \$opt{'log-msg-id'},
'username|u=s' => \$opt{'username'},
'vpopmail!' => \$opt{'vpopmail'},
'v' => \$opt{'vpopmail'},
@@ -820,6 +821,7 @@
}
}
+ $opt{'log-msg-id'} and $was_it_spam .= " $msgid";
logmsg "$was_it_spam ($msg_score/$msg_threshold) for $current_user:$> in ".
sprintf("%.1f", time - $start) ." seconds, $actual_length bytes.";
@@ -1374,6 +1376,8 @@
-r pidfile, --pidfile Write the process id to pidfile
-s facility, --syslog=facility Specify the syslog facility (default: mail)
--syslog-socket=type How to connect to syslogd (default: unix)
+ --log-msg-id Write SMTP message id in syslog when reporting
+ results of spam check
-u username, --username=username Run as username
-v, --vpopmail Enable vpopmail config
-x, --nouser-config Disable user config files
@@ -1577,6 +1581,13 @@
need to set this. If you get error messages regarding B<__PATH_LOG> or similar
from spamd, try changing this setting.
+=item B<--log-msg-id>
+
+Write SMTP message id in syslog when reporting results of spam check. Normally,
+C<spamd> logs only whether the message was clean or identified as spam. This
+option will add the SMTP message id, which can help you if you want to analyze
+mail log statistics (clean vs. spam messages, etc.).
+
=item B<-u> I<username>, B<--username>=I<username>
Run as the named user. If this option is not set, the default behaviour
Re: PATCH: spamd --log-msg-id Option
Posted by sabat <sa...@eloan.com>.
Did this patch get rejected? Don't see any evidence of it in CVS. :-(
Duncan Findlay wrote:
>On Mon, Mar 01, 2004 at 05:28:48PM -0800, Daniel Quinlan wrote:
>
>
>>sabat <sa...@eloan.com> writes:
>>
>>
>>
>>>To me, it seems like the msg id should always be there, since it's
>>>there when spamd announces that it's working on a message. But I
>>>didn't want to break anything, so it's an option. :-)
>>>
>>>
>>Sounds good to me. However, rather than a set of options, would a
>>format string be better?
>>
>>
>
>I'd prefer not. The problem with format strings is that the messages
>could be pretty much any format, which makes logcheck filters, etc
>kinda tough to do. I don't really see the value with having that.
>
>
>
--- spamd.raw.orig Mon Mar 1 16:34:54 2004
+++ spamd.raw Mon Mar 1 17:04:13 2004
@@ -122,6 +122,7 @@
'pidfile|r=s' => \$opt{'pidfile'},
'syslog|s=s' => \$opt{'syslog'},
'syslog-socket=s' => \$opt{'syslog-socket'},
+ 'log-msg-id' => \$opt{'log-msg-id'},
'username|u=s' => \$opt{'username'},
'vpopmail!' => \$opt{'vpopmail'},
'v' => \$opt{'vpopmail'},
@@ -820,6 +821,7 @@
}
}
+ $opt{'log-msg-id'} and $was_it_spam .= " $msgid";
logmsg "$was_it_spam ($msg_score/$msg_threshold) for
$current_user:$> in ".
sprintf("%.1f", time - $start) ." seconds, $actual_length bytes.";
@@ -1374,6 +1376,8 @@
-r pidfile, --pidfile Write the process id to pidfile
-s facility, --syslog=facility Specify the syslog facility
(default: mail)
--syslog-socket=type How to connect to syslogd (default:
unix)
+ --log-msg-id Write SMTP message id in syslog
when reporting
+ results of spam check
-u username, --username=username Run as username
-v, --vpopmail Enable vpopmail config
-x, --nouser-config Disable user config files
@@ -1577,6 +1581,13 @@
need to set this. If you get error messages regarding B<__PATH_LOG> or
similar
from spamd, try changing this setting.
+=item B<--log-msg-id>
+
+Write SMTP message id in syslog when reporting results of spam check.
Normally,
+C<spamd> logs only whether the message was clean or identified as spam.
This
+option will add the SMTP message id, which can help you if you want to
analyze
+mail log statistics (clean vs. spam messages, etc.).
+
=item B<-u> I<username>, B<--username>=I<username>
Run as the named user. If this option is not set, the default behaviour
Re: PATCH: spamd --log-msg-id Option
Posted by Duncan Findlay <du...@debian.org>.
On Mon, Mar 01, 2004 at 05:28:48PM -0800, Daniel Quinlan wrote:
> sabat <sa...@eloan.com> writes:
>
> > To me, it seems like the msg id should always be there, since it's
> > there when spamd announces that it's working on a message. But I
> > didn't want to break anything, so it's an option. :-)
>
> Sounds good to me. However, rather than a set of options, would a
> format string be better?
I'd prefer not. The problem with format strings is that the messages
could be pretty much any format, which makes logcheck filters, etc
kinda tough to do. I don't really see the value with having that.
--
Duncan Findlay
Re: PATCH: spamd --log-msg-id Option
Posted by sabat <sa...@eloan.com>.
I didn't see anything regarding format strings in the syslog mechanism.
Am I missing something?
Daniel Quinlan wrote:
>sabat <sa...@eloan.com> writes:
>
>
>
>>To me, it seems like the msg id should always be there, since it's
>>there when spamd announces that it's working on a message. But I
>>didn't want to break anything, so it's an option. :-)
>>
>>
>
>Sounds good to me. However, rather than a set of options, would a
>format string be better?
>
>Daniel
>
>
>
Re: PATCH: spamd --log-msg-id Option
Posted by Daniel Quinlan <qu...@pathname.com>.
sabat <sa...@eloan.com> writes:
> To me, it seems like the msg id should always be there, since it's
> there when spamd announces that it's working on a message. But I
> didn't want to break anything, so it's an option. :-)
Sounds good to me. However, rather than a set of options, would a
format string be better?
Daniel
--
Daniel Quinlan anti-spam (SpamAssassin), Linux,
http://www.pathname.com/~quinlan/ and open source consulting