Bug 151612

Summary: hostonly does not honor arguments correctly
Product: [Fedora] Fedora Reporter: Coert Vonk <coert.vonk>
Component: logwatchAssignee: Ivana Varekova <varekova>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 3   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-06-27 14:31:15 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Coert Vonk 2005-03-20 21:19:47 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.6) Gecko/20050224 Firefox/1.0.1 Fedora/1.0.1-1.3.1

Description of problem:
The man page for logwatch states:
       --hostname hostname
              Use hostname for the reports instead of this system#s hostname.
              In addition, if HostLimit is set in /etc/log.d/logwatch.conf,
              then only  logs from this hostname will be processed (where
              appropriate).

Hence, when
 - specifying "HostLimit = yes" in the logwatch.conf file, and
 - passing "--hostname HOSTNAME" on the logwatch command line,
I expect to see only reports for the specified host.

This does not work as expected due to a bug in /etc/log.d/scripts/shared/onlyhost

A simple fix would be:
--- onlyhost-	2005-03-20 12:11:17.996886937 -0800
+++ onlyhost	2005-03-20 12:11:01.506229908 -0800
@@ -13,7 +13,7 @@ if (($ENV{'LOGWATCH_DEBUG'} > 5) and $ho
 }
 
 #If called from a service config file it passes the param as an ARG
-if ($#ARGV == 0) {      #put in or override the host id
+if (length($ARGV[0])) {      #put in or override the host id
         $hostname = $ARGV[0];
 }
 


Version-Release number of selected component (if applicable):
logwatch-5.2.2-1

How reproducible:
Always

Steps to Reproduce:
1. add "HostLimit = yes" to /etc/log.d/logwatch.conf
2. have a /var/log/messages available with logs for different hosts
3. execute watchlog with "--hostname HOSTNAME"

Actual Results:  Will generate reports for all the hosts

Expected Results:  Reports only for the specified host

Additional info:

Comment 1 Ivana Varekova 2005-06-27 14:31:15 UTC
This bug is fixed in the last version (logwatch-6.1.2-1).