John Peacock said the following on 26/11/2005 23:18:
> Robin Bowes wrote:
> 
>>Right. I'd like to end up with three files:

I thought it would be useful to state why I want this:

>>1. normal log file

For "normal" debugging, information, etc.

>>2. accepted messages, parseable format

When the PHB calls complaining that he's not received that really
important mail it will be easy to check the accepted log to confirm that
it has indeed been accepted for delivery.

>>3. rejected messages, parseable format

To be able to easily produce stats showing how many messages have been
rejected and why. For example, I've just installed qpsmtpd for a client
and am using my modified adaptive plugin. A cursory inspection of the
first log file (10MB) shows me that between 2005-11-25
09:19:52.687514500 and 2005-11-26 10:04:34.700060500, qpsmtpd rejected
62666 messages. That's around 24 hours 44 minutes giving a rejection
rate of around 42 msgs/minute.

It won't be hard to analyse the data a little further and report which
plugin rejected the most mails, which IP addresses had the most
rejections, etc. etc.

> 
> Your best bet is still to keep multilog in the mix, because, as you said, you
> get automatic log rolling and purges.

Exactly. But what's the best way to do it?

> 
>>I'm not sure what you mean by isa_plugin() though. Can you elaborate?
> 
> 
> See:
> 
>       $ perldoc README.plugins
> 
> It is an easy way to subclass an existing plugin.  In essence, you would only
> override the existing hook_reject with your own version without having to
> duplicate all of the existing code.

OK, so I'd most likely subclass your adaptive plugin and override
hook_deny and hook_reset_transaction? Something like:

  # logging/accept_reject
  sub init {
      my ($self, $qp) = @_;
      $self->isa_plugin(’logging/adaptive’);
  }

  sub hook_deny {
      my ($self, $transaction, $prev_hook, $return, $return_text) = @_;
      # my stuff here

  }

  sub hook_reset_transaction {    # slog
      my ($self, $transaction, @args) = @_;
      # my stuff here
  }

Is it possible to call the subs in the parent plugin? Would I need to do
that? For example, if I override hook_reset_transaction to write a
parseable accept log I would still want logging to go to the "detailed" log.

R.
-- 
http://robinbowes.com

If a man speaks in a forest,
and his wife's not there,
is he still wrong?

Reply via email to