Bug 102242 - Sendmail report for messages sent & bytes transferred is broken
Summary: Sendmail report for messages sent & bytes transferred is broken
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: logwatch
Version: 9
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Elliot Lee
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2003-08-12 21:26 UTC by Nick White
Modified: 2007-04-18 16:56 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2004-08-20 19:10:44 UTC
Embargoed:


Attachments (Terms of Use)

Description Nick White 2003-08-12 21:26:34 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 
1.0.3705)

Description of problem:
LogWatch is supposed to report the bytes transferred and messages sent for 
sendmail, when $MsgsSent is greater than 0.  The problem is, that no matter 
what, $MsgsSent is always null, so it never runs the if statement.

The offending code is in /etc/log.d/scripts/services/sendmail.

    if($MsgsSent > 0) {
        print "\n\n" . $BytesTransferred . " bytes transferred";
        print "\n" . $MsgsSent . " messages sent";
    }

If I change the if statement to if(1) { it works.

Version-Release number of selected component (if applicable):
logwatch-4.3.1-2

How reproducible:
Always

Steps to Reproduce:
1. Send lots of messages through sendmail.
2. Set the detail level in logwatch.conf to 10 or High.
3. Run the logwatch script.  Notice that it doesn't send any information about 
bytes transferred, or messages sent.
4. Modify the if statement in the sendmail script.
5. Rerun the logwatch script, and it will send bytes transferred and messages 
sent information.
    

Additional info:

Comment 1 Elliot Lee 2003-08-13 14:13:14 UTC
The real problem is that the pattern that increments MsgsSent and BytesTransferred is not 
matching the lines in maillog. Need to get a working pattern.

Comment 2 Gilles Detillieux 2003-10-22 16:27:20 UTC
The pattern for finding the messages sent and total bytes is fine.
The problem is that $Detail isn't set.  You need to add

$Detail = $ENV{'LOGWATCH_DETAIL_LEVEL'};

at the start of /etc/log.d/scripts/services/sendmail.

The odd thing is Nick reported that the offending code began with...

if($MsgsSent > 0) {

whereas on my Red Hat 9 system, with logwatch-4.3.1-2 installed, I
find this section begins with...

if (($MsgsSent > 0) and ($Detail >= 5)) {

Setting $Detail as above made the difference for me.  If Nick did
actually change the 'if' statement to remove the reference to $Detail,
then I'm not sure what the problem is, as I can't reproduce it here.

Cheers,
Gilles

Comment 3 Nick White 2003-10-22 17:28:30 UTC
I just realized that the offending code($MsgsSent > 0) { probably came from a 
version < RedHat 9.  I've tried adding the 

$Detail = $ENV{'LOGWATCH_DETAIL_LEVEL'};

to the top of the sendmail script, and it seems to work like a charm.

Thanks,
nw

Comment 4 Elliot Lee 2004-08-20 19:10:44 UTC
It appears that logwatch 5.2.2 has this bug fixed. Cool! Thanks for
the bug report...


Note You need to log in before you can comment on or make changes to this bug.