procmail
[Top] [All Lists]

Re: "Atomic" updates to the LOGFILE...

2002-07-25 23:18:22
Michael J Wise <mjwise(_at_)kapu(_dot_)net> writes:
...
<description of kludge to atomicly add entries to the procmail log>
...
We'd like something a bit more economical in terms of processor
performance, as we are trying to run some scripts based on the logfiles
to report the 'Performance' of our SpamTraps.

What are you extracting from the logs that you need to guarantee to
be uninterwoven?  Procmail line buffers the logs**, so unless you are
matching up items logged on different lines, you don't really need
atomic writes.


I guess we could write a little script that calls lockfile, and then
appends the result, and then tosses the lock, or just put the various
logfiles into their own directory, and date 'em (log.1027659003.1234),
ec. etc. etc., but ... it would be even spiffier if ProcMail had some
sort of facility that made this automatic instead of a Kludge, However
Elegant[tm].

This is more complicated an issue than it may appear at first glance.
Actually locking the log with a kernel lock may create a denial of
service attack if the log is world readable***.

It's also basically unprecedented.  I can't think of a single program
that actually locks its log files.  Then again, e-mail and the web are
practically the only mediums where program may be run asynchronously on
behalf of a user.  Does php lock log files?  If so, how does it handle
the DoS issue?


And ideas?
Or are we just behind the times and in need of updating our software?

Can you explicitly (extract and) log the data you need for you analysis
in a single line?  If so, that should provide all the guarantee you need.


Philip Guenther
Procmail Maintainer


** Well, kinda.  It flushes its buffer if the last character logged is
a newline or if you log zero characters.  The 'abstract' logged when it
delivers a message is logged as three separate lines.

*** For some kinds of kernel locks, you only need read permission to
block write locks.
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail