SQL logging

Steve Freegard steve.freegard at LBSLTD.CO.UK
Wed Feb 26 17:58:19 GMT 2003


Thanks again for all your work on this.

As promised - I've attached a tar.gz with all the patches that you wrote
with my modifications and instructions on how to install SQL logging under
RedHat 7.3.

I've been using this live on by eval box for a few days now with no problems
- there is still plenty that could be improved on, but at least it's a

Kind regards,

-----Original Message-----
From: Julian Field [mailto:mailscanner at ECS.SOTON.AC.UK]
Sent: 23 February 2003 14:33
To: MAILSCANNER at jiscmail.ac.uk
Subject: Re: SQL logging


I have written you some code which will do this:

1. Log information about every message to a temporary file while
MailScanner is running, giving you minimum performance hit. I've written
all the code you need to do this bit.
2. When MailScanner worker processes die of old age, or are shutdown
cleanly (don't use kill -9 on them!), they will read their log file and
pump the contents into an SQL database all at 1 go, which should be nice
and quick. There are bits missing from this, see the comments in the code.

I don't log everything about each message, but I log a fair chunk of info
about each one. I assume you will customise this to log what you reckon you
It creates 1 record per message (whether clean or infected) and then also
generates an extra record for each infection report. So a clean message
will produce 1 record, a message with 2 infections will produce 3 records.
The SQL "INSERT" code is deliberately missing. You can write that better
than me anyway.

To use it, apply the other patches I supplied the other day to give you a
new configuration option "Always Looked Up Last".
Then insert the attached file on the end of CustomConfig.pm and write the
SQL code you need, and create the database and the db table this lot is
going to be written to.
Then set
        Always Looked Up Last = &SQLLogging
in your MailScanner.conf and "restart" (not just "reload") MailScanner.

To find obvious syntax errors, I would advise you do
        perl -c CustomConfig.pm
before trying to use it, as that will catch syntax screw-ups.

I make no guarantees whatsoever about the attached code actually working. I
have written it to get you started, and to show you how to pull interesting
things out of the "Message" data structure. If you want the full list of
Message attributes, read the top of Message.pm.

Please let me know how you get on. If someone can post me some working code
with all the SQL bits written and tested, I will happily include it in
future releases (next release due on 1st March).

This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: mailscanner-sql.tar.gz
Type: application/octet-stream
Size: 5657 bytes
Desc: not available
Url : http://lists.mailscanner.info/pipermail/mailscanner/attachments/20030226/c66dde60/mailscanner-sql.tar.obj

More information about the MailScanner mailing list