Fedora Linux Support Community & Resources Center
  #1  
Old 10th May 2016, 05:23 AM
bababooey182 Offline
Registered User
 
Join Date: Jun 2005
Posts: 41
macoschrome
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:
Reply With Quote
  #2  
Old 23rd June 2016, 08:28 PM
SiliconSlick's Avatar
SiliconSlick Offline
Registered User
 
Join Date: Aug 2009
Location: College Station, TX
Posts: 502
linuxfedorafirefox
Re: logwatch configs for dnf

Thanks a lot! Just what I was looking for.

SS
Reply With Quote
Reply

Tags
configs , dnf , logwatch

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Logwatch reports empty!! how to debug logwatch? paul sanz Using Fedora 1 26th June 2008 10:29 AM
Is there a way to run different configs for yum? schwim Using Fedora 8 10th August 2006 03:06 AM


Current GMT-time: 19:44 (Thursday, 19-10-2017)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat