Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 183762 - sys-apps/logwatch-7.3.6 install produces no output when run by default crontab
Summary: sys-apps/logwatch-7.3.6 install produces no output when run by default crontab
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal with 3 votes (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-06-30 19:19 UTC by Simon Matthews
Modified: 2011-06-19 21:49 UTC (History)
15 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Restore previous (and useful) behavior where logwatch actually sends it output someplace useful (mailto:root) (cron.patch,308 bytes, patch)
2009-02-27 03:15 UTC, Robert Trace
Details | Diff
Ebuild patch for logwatch 7.3.6-r1 (logwatch-7.3.6-r1.ebuild.patch,2.62 KB, patch)
2009-08-18 18:47 UTC, Phil Davidov
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Matthews 2007-06-30 19:19:43 UTC
The default for Logwatch-7.3.6 has changed to print the output to stdout, however, the crontab file in /etc/cron.daily/00-logwatch redirects stdout to /dev/null. 

Reproducible: Always

Steps to Reproduce:
1.emerge logwatch
2. /etc/cron.daily/00-logwatch
3. 

Actual Results:  
No output, no email.
Comment 1 Jeremy Sermersheim 2007-07-24 00:25:41 UTC
I had the same issue but fixed it with creating a conf directory in /etc/logwatch (i.e. /etc/logwatch/conf) and copying /usr/share/logwatch/default.conf/logwatch.conf into /etc/logwatch/conf (i.e. cp /usr/share/logwatch/default.conf/logwatch.conf /etc/logwatch/conf).  Then change the Print option from Yes to No.

That fixed my issue.
Comment 2 Mark Wagner 2007-12-23 03:50:37 UTC
(In reply to comment #0)
> The default for Logwatch-7.3.6 has changed to print the output to stdout,
> however, the crontab file in /etc/cron.daily/00-logwatch redirects stdout to
> /dev/null. 

Logwatch versions newer than 7.3.4 will by default print the output to stdout rather than mailing it.  Since you've got output redrected to /dev/null, you're discarding it.  Either configure Logwatch to do its own mailing, or remove the redirect so that cron can mail it.
Comment 3 Simon Matthews 2007-12-23 06:33:11 UTC
In response to Mark Wagner, I think that you are missing my point. 

The ebuild creates a crontab file which sends the output to /dev/null. There is absolutely no point in installing logwatch if you are going to send the output to /dev/null. 

Yes, it is an easy fix for the user, but why is it this way in the first place? 

To clarify further -- you say "you've got output redrected to /dev/null", but in this case, the use of "you" is inaccurate -- it is the ebuild that sets it up this way. 
Comment 4 Eray Aslan gentoo-dev 2008-05-11 07:31:13 UTC
The default behaviour of logwatch changed.  At least an ewarn in the ebuild would be appropriate.  Principle of least surprise.
Comment 5 Robert Trace 2009-02-27 03:15:07 UTC
Created attachment 183334 [details, diff]
Restore previous (and useful) behavior where logwatch actually sends it output someplace useful (mailto:root)

As was previously indicated, logwatch 7.3.4 -> 7.3.5 changed the default behavior of e-mailing results to just printing results.  This makes Gentoo's default cron entry useless.

With logwatch 7.3.6 recently going stable, this problem is exacerbated.  So, here's a patch to make logwatch's default installation useful again.
Comment 6 Thomas Beutin 2009-03-07 15:33:07 UTC
(In reply to comment #5)
> With logwatch 7.3.6 recently going stable, this problem is exacerbated.  So,
> here's a patch to make logwatch's default installation useful again.
IMHO the cron $MAILTO is not alwas the destination for the logwatch output, esp. if one have configured a "MailTo" in the logwatch configuration.
I suggest an entry in on the following files:
- /etc/logwatch/conf/logwatch.conf
    "Print = No"
- /etc/logwatch/conf/override.conf
    "logwatch: Print = No"
This restore the prev. behavoir of logwatch

BTW: an ewarn had saved an hour or two for me ;)
Comment 7 Robert Trace 2009-03-08 06:59:47 UTC
(In reply to comment #6)
> IMHO the cron $MAILTO is not alwas the destination for the logwatch output,
> esp. if one have configured a "MailTo" in the logwatch configuration.

Good point, however, I still agree with upstream's decision.  I like the idea that running logwatch from the command-line spits out a bunch of stuff to stdout instead of e-mailing output by default.  (That way I don't have to remember to tell it _not_ to e-mail something when I'm messing with it from the command-line.)

You're right, however, the cron patch above doesn't "restore previous functionality", it just makes logwatch start e-mailing again instead of doing nothing. :-)
Comment 8 Simon Matthews 2009-03-08 18:40:43 UTC
It's the crontab entry that needs to change.

The file /etc/cron.daily/00-logwatch is where the problem lies. This file is a Gentoo-provided file -- it is not part of upstream Logwatch. 

It makes no sense to have a crontab file that redirects the output of logwatch to /dev/null. 

All it needs is the removal of "2>&1 > /dev/null" How hard is that? 
Comment 9 Eric Martin 2009-03-27 15:21:14 UTC
(In reply to comment #5)
> Created an attachment (id=183334) [edit]
> Restore previous (and useful) behavior where logwatch actually sends it output
> someplace useful (mailto:root)
> 
> As was previously indicated, logwatch 7.3.4 -> 7.3.5 changed the default
> behavior of e-mailing results to just printing results.  This makes Gentoo's
> default cron entry useless.
> 
> With logwatch 7.3.6 recently going stable, this problem is exacerbated.  So,
> here's a patch to make logwatch's default installation useful again.
> 

I was burnt by this on two of my production machines.  There was no ewarn, and having the current 00-logwatch cron file makes 0 sense.  This patch keeps everything working the way everybody expects it to without breaking anything.  Also, if you run logwatch from the command line it will work just as intended.
Comment 10 Kevin Parent 2009-04-20 15:19:22 UTC
I recently ran emerge -e world and logwatch stopped sending me email reports.  I must have just edited /usr/share/logwatch/default.conf/logwatch.conf, because /etc/logwatch was just an empty directory.  Either that or the reinstall nuked all my files there.

In any case, Comment #1 is correct. Creating the subdirectory /etc/logwatch/conf and copying /usr/share/logwatch/default.conf/logwatch.conf to /etc/logwatch/conf/ then changing "Print = Yes" to "Print = No" does the trick.  The cron job file is fine.

IMO, the ebuild should at the very least create the subdirectory and copy the standard config file there.  The option to "Print" or "mail" should be left for the user to decide.
Comment 11 Phil Davidov 2009-08-18 18:47:49 UTC
Created attachment 201640 [details, diff]
Ebuild patch for logwatch 7.3.6-r1

- Added ewarn to ebuild about cron/printing/mailing behavior (suggestion Comment #4)
- Changed ebuild to create local copy of logwatch.conf in /etc/logwatch/conf in order to make logwatch behavior customization more straight-forward (suggestion Comment #10)
- Minor ebuild cleaned-up
Comment 12 Benedikt Böhm (RETIRED) gentoo-dev 2009-12-04 11:25:12 UTC
fixed in sys-apps/logwatch-7.3.7_pre20091204