Re: Patch for DNF support using dnf.rpm.log

John Saalwaechter <[email protected]> Tue, 26 Apr 2016 22:12:09 -0700
Newsgroups gmane.comp.log.logwatch.devel
Message-ID <CAMLk3gGHwOzk_Xvhqx1sr1Vj7J55YLUE3AJwPS3R19_VvCYEew@mail.gmail.com>
Can this be posted to the list?  It's awaiting moderator approval.

--
[email protected]

On Tue, Apr 12, 2016 at 11:08 PM, John Saalwaechter <[email protected]>
wrote:

> Regarding
> https://sourceforge.net/p/logwatch/discussion/1115929/thread/b1b18086/,
> here is a patch that uses the dnf.rpm.log files.  Can it be added to the
> project?
>
> Index: conf/logfiles/dnf-rpm.conf
> ===================================================================
> diff --git a/trunk/conf/logfiles/dnf-rpm.conf
> b/trunk/conf/logfiles/dnf-rpm.conf
> new file mode 10644
> --- /dev/null   (nonexistent)
> +++ b/trunk/conf/logfiles/dnf-rpm.conf  (working copy)
> @@ -0,0 +1,9 @@
> +# What actual file?  Defaults to LogPath if not absolute path....
> +LogFile = dnf.rpm.log
> +
> +Archive = dnf.rpm.log-*
> +
> +# Keep only the lines in the proper date range...
> +*ApplyStdDate = "%b %d %H:%M:%S"
> +
> +# vi: shiftwidth=3 tabstop=3 et
> Index: conf/services/dnf-rpm.conf
> ===================================================================
> diff --git a/trunk/conf/services/dnf-rpm.conf
> b/trunk/conf/services/dnf-rpm.conf
> new file mode 10644
> --- /dev/null   (nonexistent)
> +++ b/trunk/conf/services/dnf-rpm.conf  (working copy)
> @@ -0,0 +1,6 @@
> +Title = "dnf-rpm"
> +
> +# Which logfile group...
> +LogFile = dnf-rpm
> +
> +# vi: shiftwidth=3 tabstop=3 et
> Index: scripts/services/dnf-rpm
> ===================================================================
> diff --git a/trunk/scripts/services/dnf-rpm b/trunk/scripts/services/dnf-
> rpm
> new file mode 10644
> --- /dev/null   (nonexistent)
> +++ b/trunk/scripts/services/dnf-rpm    (working copy)
> @@ -0,0 +1,85 @@
> +###########################################################
> ###############
> +# $Id: yum 150 2013-06-18 22:19:38Z mtremaine $
> +###########################################################
> ###############
> +########################################################
> +# Please send all comments, suggestions, bug reports,
> +#    etc, to [email protected]
> +########################################################
> +
> +#######################################################
> +## Copyright (c) 2008 Sy Beamont <[email protected]>
> +## 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]
> +#########################################################
> +
> +$Debug = $ENV{'LOGWATCH_DEBUG'} || 0;
> +
> +if ( $Debug >= 5 ) {
> +   print STDERR "\n\nDEBUG: Inside dnf-rpm Filter \n\n";
> +   $DebugCounter = 1;
> +}
> +
> +while (defined($ThisLine = <STDIN>)) {
> +   if ( $Debug >= 5 ) {
> +      print STDERR "DEBUG($DebugCounter): $ThisLine";
> +      $DebugCounter++;
> +   }
> +
> +   if ( $ThisLine =~ s/^.* INFO Upgraded: ([^ ]+)/$1/ ) {
> +      $PackageUpdated{$ThisLine}++;
> +   } elsif ( $ThisLine =~ s/^.* INFO Installed: ([^ ]+)/$1/ ) {
> +      $PackageInstalled{$ThisLine}++;
> +   } elsif ( $ThisLine =~ s/^.* INFO Erased: ([^ ]+)/$1/ ) {
> +      $PackageErased{$ThisLine}++;
> +   } elsif ( $ThisLine =~ m/INFO --- logging initialized ---/ ) {
> +      $ignoredlines++;
> +   } elsif ( $ThisLine =~ m/INFO Cleanup: / ) {
> +      $ignoredlines++;
> +   } else {
> +      # Report any unmatched entries...
> +      push @OtherList,$ThisLine;
> +   }
> +}
> +
> +if (keys %PackageInstalled) {
> +   print "\nPackages Installed:\n";
> +   foreach $ThisOne (sort {lc($a) cmp lc($b)} keys %PackageInstalled) {
> +      print "   " . $ThisOne;
> +   }
> +}
> +if (keys %PackageUpdated) {
> +   print "\nPackages Updated:\n";
> +   foreach $ThisOne (sort {lc($a) cmp lc($b)} keys %PackageUpdated) {
> +       print "   ". $ThisOne;
> +   }
> +}
> +if (keys %PackageErased) {
> +   print "\nPackages Erased:\n";
> +   foreach $ThisOne (sort {lc($a) cmp lc($b)} keys %PackageErased) {
> +       print "   ". $ThisOne;
> +   }
> +}
> +
> +if ($#OtherList >= 0) {
> +   print "\n**Unmatched Entries**\n";
> +   print @OtherList;
> +}
> +
> +exit(0);
> +
> +# vi: shiftwidth=3 tabstop=3 syntax=perl et
> +# Local Variables:
> +# mode: perl
> +# perl-indent-level: 3
> +# indent-tabs-mode: nil
> +# End:
>

------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z

_______________________________________________
Logwatch-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/logwatch-devel