Re: Logwatch Dovecot Deliver Summary

"Klaipedaville on Google" <[email protected]>
Newsgroups gmane.comp.log.logwatch.devel
Message-ID <C145653423714ECB916456CE720E80C6@Computer>
Hello Patrick,

Thank you so much for responding and for your assistance.

I though as much that it was a reference to a different file or some line numbers in code but couldn’t really figure it out how it is used / applied in the script. 

I normally modify it via text editors and I mostly understand what all the other lines are saying, with regex being the easiest part as it’s pretty much the same as PHP.

The thing also is that I think it is supposed to produce a bit of a summary at the end in accordance with your code is that not right? But for some reason it does not. Let’s take your lda deliver keys for example. My detail level is set to 10.

if (keys %Deliver) {
   my $DeliverCount = 0;
   my $DeliverUserCount = {};
   foreach my $User (keys %Deliver) {
      foreach my $Mailbox (keys %{$Deliver{$User}}) {
         $DeliverUserCount{$User} += $Deliver{$User}{$Mailbox};
      }
      $DeliverCount += $DeliverUserCount{$User};
   }
   printf "\n" if ($Detail >= 5);
   printf "\nDovecot Deliveries: %s", $DeliverCount;
   if ($Detail >= 5) {
      foreach my $User (sort { $DeliverUserCount{$b} <=  and so on...

I will let you know the results as soon as I test it all out.

Regards,
Dennis.


From: Patrick Vande Walle 
Sent: Saturday, May 10, 2014 14:55
To: Klaipedaville on Google ; Mike Tremaine ; Patrick Vande Walle 
Cc: [email protected] ; [email protected] 
Subject: Re: [Logwatch-devel] Logwatch Dovecot Deliver Summary

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
>
>
>

------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs

_______________________________________________
Logwatch-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/logwatch-devel
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.