Re: Logwatch Dovecot Deliver Summary

Patrick Vande Walle <[email protected]>
Newsgroups gmane.comp.log.logwatch.devel
Organization ISOC Luxembourg ASBL
Message-ID <[email protected]>
Dennis,

This is a diff file, which is applied with the patch command.

However, the change being really small, you could also do it with a text
editor

- Open /usr/share/logwatch/scripts/services/dovecot  with a text editor

- Look for the line starting with
    } elsif ( ($User, $Mailbox) = ( $ThisLine =~ /^$dovecottag
(?:lda|deliver)\((.*)\): msgid=.*: saved mail to (\S+)/ ) ) {

- Replace it with:
  } elsif ( ($User, $Mailbox) = ( $ThisLine =~ /^$dovecottag
(?:lda|deliver)\((.*)\):(.Info:)? msgid=.*: saved mail to (\S+)/ ) ) {

- Save.

- Test with "logwatch --output stdout --service dovecot" to see if it works.
You may need to tweak the regex. Perl regex syntax is essentially the
same as PHP. Your PHP knowledge will help.  

The reason  why the original regex fails is that the developer added the
word "Info:" before "msgid" in later versions of the 2.x series. The
proposed change allows this word as an option.

Regards,
Patrick


On 10/05/14 12:16, Klaipedaville on Google wrote:
> Hello Patrick,
>
> Thank you so much for replying and for your suggestion. I will try it
> and let you know.
>
> Although I am not quite sure where do I insert the first part that
> starts from --- dovecot.orig and ends on @@ ?
>
> This is the code:
>  --- dovecot.orig 2014-05-10 09 <tel:2014051009>:45:39.795499290
> <tel:39795499290> +0200 +++ dovecot 2014-05-10 10
> <tel:2014051010>:01:25.538429031 <tel:25538429031> +0200 @@ -179,7
> +179,7 @@
>
> The last time I tried it my perl complained on @ and -179,7 +179,7 and
> symbols like this being syntax errors.
>
> Many thanks! I really do appreciate your help!
>
> Regards,
> Dennis.
>
>
>
> -----Original Message-----
> From: Patrick Vande Walle <[email protected]>
> To: Klaipedaville on Google <[email protected]>, Mike Tremaine
> <mgt-DY+kYuDXiUrz68fS/h/[email protected]>
> Cc: [email protected], [email protected]
> Sent: Sat, 10 May 2014 11:09
> Subject: Re: [Logwatch-devel] Logwatch Dovecot Deliver Summary
>
> Dennis,
>
> Please try the following patch:
>
> --- dovecot.orig    2014-05-10 09 <tel:2014051009>:45:39.795499290
> <tel:39795499290> +0200
> +++ dovecot    2014-05-10 10 <tel:2014051010>:01:25.538429031
> <tel:25538429031> +0200
> @@ -179,7 +179,7 @@
>        }
>  
>  # 'lda' for dovecot 2.0, 'deliver' for earlier versions
> -    } elsif ( ($User, $Mailbox) = ( $ThisLine =~ /^$dovecottag
> (?:lda|deliver)\((.*)\): msgid=.*: saved mail to (\S+)/ ) ) {
> +    } elsif ( ($User, $Mailbox) = ( $ThisLine =~ /^$dovecottag
> (?:lda|deliver)\((.*)\):( Info:)? msgid=.*: saved mail to (\S+)/ ) ) {
>        $Deliver{$User}{$Mailbox}++;
>  
>  # For Sieve-based delivery
>
> This is untested. My system uses the Sieve lda, which returns other
> strings.
> If it works for you, please report back so Mike can update the sources.
>
> Regards,
>
> Patrick Vande Walle
>
>
>



------------------------------------------------------------------------------
Is your legacy SCM system holding you back? Join Perforce May 7 to find out:
&#149; 3 signs your SCM is hindering your productivity
&#149; Requirements for releasing software faster
&#149; Expert tips and advice for migrating your SCM now
http://p.sf.net/sfu/perforce
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.