logwatch patches - smartd

"gulikoza" <[email protected]>
Newsgroups gmane.comp.log.logwatch.devel
Message-ID <[email protected]>
Smartd script will not compress identical unmatched entries. Although the
script has been improved in r84, it would be future proof to match identical
entries and not inflate the report unnecessarily.

 

Regards,

gulikoza

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev

_______________________________________________
Logwatch-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/logwatch-devel
logwatch-smartd.patch (application/octet-stream, 905 B)
diff --git a/scripts/services/smartd b/scripts/services/smartd
--- a/scripts/services/smartd
+++ b/scripts/services/smartd
@@ -56,7 +56,7 @@ my %CantMonitor = ();
 my $UnableToMonitor = 0;
 my %SelfTest = ();
 my %Failed = ();
-my @OtherList = ();
+my %OtherList = ();
 my $DLine = 0;
 my %UnavailableDev = ();
 my %SataDisk = ();
@@ -188,7 +188,7 @@ while (defined(my $ThisLine = <STDIN>)) {
       $CheckFailed{$Device}++;
    } else {
       # Report any unmatched entries...
-      push @OtherList,"$ThisLine\n";
+      $OtherList{$ThisLine}++;
    }
 
 }
@@ -360,9 +360,11 @@ if (%SataDisk) {
    print "\n";
 }
 
-if (($#OtherList >= 0) and (not $IgnoreUnmatched)){
+if ((%OtherList) and (not $IgnoreUnmatched)){
    print "\n**Unmatched Entries**\n";
-   print @OtherList;
+   foreach my $line (sort keys %OtherList) {
+      print $line." : " .$OtherList{$line}." time(s)\n";
+   }
 }
 
 exit(0);
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.