Log messages

David Relson relson at osagesoftware.com
Tue Mar 3 13:58:09 CET 2009


On Sun, 1 Mar 2009 08:52:10 -0800
Serguei Miridonov wrote:

> Hello,
> 
> Regarding logging facility of bogofilter when run by user, isn't it 
> more logical to add an option to place log messages in a user log
> file instead of sending it to syslog?

Bogofilter sets up for logging with:

   openlog("bogofilter", LOG_PID, LOG_MAIL);

and logs with:

    syslog(LOG_INFO, "%s\n", msg_bogofilter);
	
Syslog is highly configurable and is flexible in how/where it saves
logging messages.  Try configuring it and let us know what happens.
The info will make a good entry for the FAQ!

> Also, the log options in configuration file enable reporting of the
> IP address from the first 'received' header. This is OK when
> bogofilter is run by system on the first mail relay (on the edge) in
> a local domain. But when it is run by user it is better to log first
> IP address outside of local domain (must be specified in system/user 
> configuration file).

An interesting idea.  I'll give it some thought.

> And finally, if the log may inclide MessageID header, why not include 
> "From: " header, as well as others specified by user?

Non-trivial.  Two issues come to mind:

Bogofilter breaks a message into tokens and doesn't care about "lines"
as do you and I.  The parsing code (in src/lexer_v3.l) recognizes "To",
"CC", "From",  etc and uses this info to set tags to create tokens like
"From:example.com".  It doesn't have a "From line" to include in a log
record.

Bogofilter has several special formatting functions (in src/format.c)
that it uses to build strings for the X-Bogosity message, the logging
message, etc.  The routines use a printf style string with some special
formatting characters (see bogofilter.cf.example).  These are
hard-coded.  Each line type needs its own formatting character, for
example "%T" for "To", "%C" for "CC", etc.  The scheme is not easily
extended to allow the user specified headers.

> Anyway, bogofilter is a great program, thanks!

Glad you like bogofilter.  I'll give your ideas some thought, but no
promises...  However if _you_ feel like contributing some code ...

> Please, send replies to my address because I'm not subscribed to the 
> list.

Consider subscribing.  Messages from non-subscribers get delayed at
best and auto-discarded at worst.

Regards,

David



More information about the bogofilter-dev mailing list