SF.net SVN: logwatch:[271] trunk

[email protected] Wed, 24 Dec 2014 09:56:58 +0000
Newsgroups gmane.comp.log.logwatch.devel
Message-ID <[email protected]>
Revision: 271
          http://sourceforge.net/p/logwatch/code/271
Author:   stefjakobs
Date:     2014-12-24 09:56:57 +0000 (Wed, 24 Dec 2014)
Log Message:
-----------
logwatch: add env variables which export a list of log and archive
files. Example configuration in clam-update

Modified Paths:
--------------
    trunk/HOWTO-Customize-LogWatch
    trunk/scripts/logwatch.pl
    trunk/scripts/services/clam-update

Modified: trunk/HOWTO-Customize-LogWatch
===================================================================
--- trunk/HOWTO-Customize-LogWatch	2014-12-11 16:54:56 UTC (rev 270)
+++ trunk/HOWTO-Customize-LogWatch	2014-12-24 09:56:57 UTC (rev 271)
@@ -16,6 +16,7 @@
     B. Service Filter Configuration
     C. Service Filer Executable
     D. Shared Script Commands
+    E. Environment Information
   7. For More Information
 
 
@@ -546,7 +547,23 @@
             service names, e.g.:
             * RemoveService = "myservice,myotherservice"
 
+E. Environment Information
+--------------------------
 
+The following Informations can be accessed from environment variables inside
+service scripts, e.g.
+   print "service logfile list: $ENV{'LOGWATCH_LOGFILE_LIST'}"
+
+         - LOGWATCH_LOGFILE_LIST
+             space separated list of logfiles which are configured for that
+             service.
+
+         - LOGWATCH_ARCHIVE_LIST
+             space separated list of archive files which are configured for
+             that service.
+
+         - TODO list other env variables.
+
 7. For More Information
 =======================
 

Modified: trunk/scripts/logwatch.pl
===================================================================
--- trunk/scripts/logwatch.pl	2014-12-11 16:54:56 UTC (rev 270)
+++ trunk/scripts/logwatch.pl	2014-12-24 09:56:57 UTC (rev 271)
@@ -1292,6 +1292,22 @@
             }
          }
       }
+      # set env variables LOGWATCH_mumble_LIST
+      push @EnvList, 'LOGWATCH_LOGFILE_LIST';
+      push @EnvList, 'LOGWATCH_ARCHIVE_LIST';
+      foreach my $LogGroup (@FileList) {
+         foreach my $log (@{$LogFileData{$LogGroup}{'logfiles'}}) {
+            $ENV{'LOGWATCH_LOGFILE_LIST'} .= $log . " ";
+         }
+         foreach my $archive (@{$LogFileData{$LogGroup}{'archives'}}) {
+            $ENV{'LOGWATCH_ARCHIVE_LIST'} .= $archive . " ";
+         }
+      }
+      if ($Config{'debug'}>4) {
+         print "\nexport LOGWATCH_LOGFILE_LIST='$ENV{LOGWATCH_LOGFILE_LIST}'";
+         print "\nexport LOGWATCH_ARCHIVE_LIST='$ENV{LOGWATCH_ARCHIVE_LIST}'";
+      }
+
       # ECP - insert the host stripping now
       my $HostStrip = " ";
       if ($Config{'hostformat'} ne "none") { #8.0

Modified: trunk/scripts/services/clam-update
===================================================================
--- trunk/scripts/services/clam-update	2014-12-11 16:54:56 UTC (rev 270)
+++ trunk/scripts/services/clam-update	2014-12-24 09:56:57 UTC (rev 271)
@@ -1,42 +1,4 @@
-##########################################################################
-## $Id$
 ###########################################################################
-# $Log: clam-update,v $
-# Revision 1.22  2010/05/09 20:15:19  stefan
-# fix: 'Received signal:' format changed
-#
-# Revision 1.21  2009/02/20 17:15:19  mike
-# Added filter for Timestamp set by freshclam, thanks Frantisek Hanzlik for pointing this out -mgt
-#
-# Revision 1.20  2008/06/30 23:07:51  kirk
-# fixed copyright holders for files where I know who they should be
-#
-# Revision 1.19  2008/03/24 23:31:26  kirk
-# added copyright/license notice to each script
-#
-# Revision 1.18  2007/01/10 22:22:21  bjorn
-# Clarifying options when daemon fails.
-#
-# Revision 1.17  2006/09/15 16:16:09  bjorn
-# Added additional instructions for syslog logging.
-#
-# Revision 1.16  2006/01/20 23:03:57  bjorn
-# Fix trailing space when using syslog; problem identified by Kenneth Porter.
-#
-# Revision 1.15  2006/01/10 17:28:01  bjorn
-# Corrected typo, by Sergey Svishchev.
-#
-# Revision 1.14  2005/12/01 04:15:55  bjorn
-# Made starts less verbose.
-#
-# Revision 1.13  2005/10/31 16:21:20  bjorn
-# Updates to paths to reflect new Filesystem Hierarchy Standard,
-# by Ivana Varekova.
-#
-# Revision 1.12  2005/05/03 19:34:30  bjorn
-# Added support for new date ranges
-#
-###########################################################################
 # clam-update script for Logwatch
 # Analyzes the Clam Anti-Virus update log
 #
@@ -175,7 +137,7 @@
    print "ClamAV update process).  If the freshclam daemon is not running,\n";
    print "you may need to restart it.  Other options:\n\n";
    print "A. If you no longer wish to run freshclam, deleting the log file\n";
-   print "   (default is freshclam.log) will suppress this error message.\n\n";
+   print "   (configured is $ENV{'LOGWATCH_LOGFILE_LIST'}) will suppress this error message.\n\n";
    print "B. If you use a different log file, update the appropriate\n";
    print "   configuration file.  For example:\n";
    print "      echo \"LogFile = log_file\" >> /etc/logwatch/conf/logfiles/clam-update.conf\n";

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.


------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net