Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 236618 - logwatch ignores anacron setting of mailto
Summary: logwatch ignores anacron setting of mailto
Alias: None
Product: Fedora
Classification: Fedora
Component: logwatch
Version: 6
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Ivana Varekova
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2007-04-16 19:35 UTC by Todd Denniston
Modified: 2007-11-30 22:12 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2007-04-20 10:27:54 UTC

Attachments (Terms of Use)
a testing anacrontab to be used as /tmp/anacrontab in the desription. (deleted)
2007-04-16 19:35 UTC, Todd Denniston
no flags Details

Description Todd Denniston 2007-04-16 19:35:27 UTC
Description of problem:
logwatch ignores anacron setting of mailto, which can prevent log analysis from
being delivered where it is needed.

Version-Release number of selected component (if applicable):
Note this also affects earlier versions too.

How reproducible:

Steps to Reproduce:
1. in /etc/anacrontab set MAILTO=yourUname@your.address
2. get anacron to run logwatch again (cron.daily to be ran)
anacron -d -t /tmp/anacrontab -f -n

Actual results:
Mail is sent to the root user.

Expected results:
Mail is sent to the address defined in the /etc/anacrontab MAILTO variable.

Additional info:
$ ls /tmp/t.daily/ -l
lrwxrwxrwx  ... 0logwatch -> /usr/share/logwatch/scripts/

the following patch works for me, though it may not be the cleanest method.
--- logwatch-7.3/scripts/       2007-04-16 13:10:55.000000000 -0500
+++ logwatch-7.3/scripts/    2007-04-16 14:26:34.000000000 -0500
@@ -306,6 +306,13 @@


+#if MAILTO is set in the environment, grab it as we may be being used by
+#cron or anacron, which do not set command line args.
+if ($ENV{'MAILTO'})
+  {
+    $Config{'mailto'} = $ENV{'MAILTO'};
+  }
 if ($OldMailTo ne $Config{'mailto'}) {
    $Config{'print'} = 0;
 } elsif ($OldPrint ne $Config{'print'}) {

Comment 1 Todd Denniston 2007-04-16 19:35:27 UTC
Created attachment 152713 [details]
a testing anacrontab to be used as /tmp/anacrontab in the desription.

Comment 2 Ivana Varekova 2007-04-20 10:27:54 UTC
Fixed in logwatch-7.3.4-7.fc7.

Comment 3 Matthew Miller 2007-07-10 11:14:49 UTC
I'm not sure the "expected results" in comment #0 are expected at all. I expect
*non-error* output to be mailed to wherever is configured in logwatch.conf. And
I expect that to be root by default -- then, the root alias should be defined as
going somewhere useful in /etc/aliases. I would expect cron error output to be
sent to the MAILTO address, though.

Comment 4 Todd Denniston 2007-07-10 13:58:34 UTC
Re: comment #3
I also expected logwatch.conf to be the place to get the value into logwatch's
system after finding that it was by default ignoring the environment variable,
however all the manipulations of
/etc/logwatch/conf/[logwatch.conf|override.conf] failed to get logwatch to use
the value set in MAILTO.  
FYI the last mods I made to logwatch.conf was to put the following line in:
I had tried many variations on this line, all were ignored by logwatch.

The reason the expected results are different from the actual is (I conjecture)
that when logwatch was written, it was done as a tool ment to be ran from the
command line by hand or the original cron instead of from anacron.
The portion of least supprise that is/was violated by logwatch is that when
anything is ran from anacron, unless that program is told explicitly otherwise
in it's config file, the output should be sent to the location anacron has been
told to send it, i.e., MAILTO, or if MAILTO is notset to the default user
cron/anacron is running as.

The reason that /etc/aliases is not a usefull suggestion, is if 
/etc/mail/ has been set up with masquerade_envelope &
masquerade_entire_domain (required for my location), the 'root' user is no
longer processed localy (.forward or /etc/aliases processed) even  with
LOCAL_USER(root) set in (under FC4). Although this may be a problem
with sendmail's processing of, the workaround for a cron job that had
no other explicit configuration should have been as simple as setting the MAILTO
variable for ALL cron jobs controled by that [ana]crontab.

Comment 5 Matthew Miller 2007-07-10 14:06:19 UTC
Oh, I see. Do you have "Print=No" set in logwatch.conf?

Comment 6 Todd Denniston 2007-07-10 14:35:19 UTC
No, except for the testing line for MailTo, my logwatch.conf was as delivered
from fedora [one comment line].

Comment 7 Matthew Miller 2007-07-10 14:43:50 UTC
Some versions (not sure exactly when it started) have "Print=Yes" by default,
which causes the output to go to stdout rather than being sent to the MailTo
address. Make sure it's set to No. (see bug #247611)

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