FedoraForum.org - Fedora Support Forums and Community
Results 1 to 2 of 2

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2005
    Posts
    41

    Arrow logwatch configs for dnf

    I created a patch for logwatch to support dnf package changes. It adds this type of output to logwatch reports:

    Code:
    --------------------- dnf-rpm Begin ------------------------
    
     Packages Updated:
        dhcp-client-12:4.3.3-9.P1.fc23.i686
        dhcp-common-12:4.3.3-9.P1.fc23.noarch
        dhcp-libs-12:4.3.3-9.P1.fc23.i686
        openssl-1:1.0.2h-1.fc23.i686
        openssl-libs-1:1.0.2h-1.fc23.i686
    
     ---------------------- dnf-rpm End -------------------------
    The patch is posted to the logwatch mailing list at https://sourceforge.net/p/logwatch/m...m/#msg35045318

    Also here for reference:

    Code:
    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 logwatch-devel@lists.sourceforge.net.
    +########################################################
    +
    +#######################################################
    +## Copyright (c) 2008 Sy Beamont <sbeam@attbi.com>
    +## 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 logwatch-devel@lists.sourceforge.net.
    +#########################################################
    +
    +$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:

  2. #2
    Join Date
    Aug 2009
    Location
    College Station, TX
    Posts
    502

    Re: logwatch configs for dnf

    Thanks a lot! Just what I was looking for.

    SS

Similar Threads

  1. Logwatch reports empty!! how to debug logwatch?
    By paul sanz in forum Using Fedora
    Replies: 1
    Last Post: 26th June 2008, 10:29 AM
  2. Is there a way to run different configs for yum?
    By schwim in forum Using Fedora
    Replies: 8
    Last Post: 10th August 2006, 03:06 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •