Fwd: Bug#712681: logwatch: better support for rsyslog

Willi Mann <[email protected]>
Newsgroups gmane.comp.log.logwatch.devel
Message-ID <[email protected]>
Hi,

attached is another contribution by a Debian user, for rsyslogd messages.

thanks
WM

-------- Original Message --------
Subject: Bug#712681: logwatch: better support for rsyslog
Resent-Date: Tue, 18 Jun 2013 14:21:01 +0000
Resent-From: Teemu Ikonen <[email protected]>
Resent-To: [email protected]
Resent-CC: [email protected], Willi Mann <[email protected]>
Date: Tue, 18 Jun 2013 16:19:02 +0200
From: Teemu Ikonen <[email protected]>
Reply-To: Teemu Ikonen <[email protected]>, [email protected]
To: Debian Bug Tracking System <[email protected]>

Package: logwatch
Version: 7.4.0+svn20130529rev144-1
Severity: wishlist
Tags: patch

The syslogd service in logwatch seems to support some other syslogd than
rsyslogd, which is the default in Debian.

Attached are a perl script and a service configuration file which match
common logfile entries from rsyslogd.

Best,
Teemu

------------------------------------------------------------------------------
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
rsyslogd.script (text/x-perl, 1.7 KB)
#!/usr/bin/perl

#######################################################
## Copyright (c) 2013 Teemu Ikonen
## Covered under the included MIT/X-Consortium License:
##    http://www.opensource.org/licenses/mit-license.php
## All modifications and contributions by other persons to
## this script are assumed to have been donated to the
## Logwatch project and thus assume the above copyright
## and licensing terms.  If you want to make contributions
## under your own copyright or a different license this
## must be explicitly stated in the contribution an the
## Logwatch project reserves the right to not accept such
## contributions.  If you have made significant
## contributions to this script and want to claim
## copyright please contact [email protected]
#########################################################

my $Detail = $ENV{'LOGWATCH_DETAIL_LEVEL'} || 0;

while (defined($ThisLine = <STDIN>)) {
   chomp($ThisLine);
   if ($ThisLine =~ /^.*] start$/) {
      $Starts++;
   }
   elsif ($ThisLine =~ /^.*rsyslogd was HUPed$/) {
      $HUPs++;
   }
   else {
      # Report any unmatched entries...
      $OtherList{$ThisLine}++;
   }
}

if ($Starts and ($Detail >=10) ) {
    print "\nrsyslogd started " . $Starts . " Time(s)\n";
}

if ($HUPs and ($Detail >=10) ) {
    print "\nrsyslogd closed files " . $HUPs. " Time(s)\n";
}

if (keys %OtherList) {
   print "\n**** Unmatched entries ****\n";
   foreach $Error (keys %OtherList) {
      print "    $Error : $OtherList{$Error} Times\n";
   }
}

exit(0);

# vi: shiftwidth=3 tabstop=3 syntax=perl et
# Local Variables:
# mode: perl
# perl-indent-level: 3
# indent-tabs-mode: nil
# End:
rsyslogd.conf (text/plain, 86 B)
Title = "rsyslogd"
LogFile =
LogFile = syslog
*OnlyService = rsyslogd
*RemoveHeaders
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.