Printing by default
"Bjorn L." <[email protected]>
| Newsgroups | gmane.comp.log.logwatch.devel |
|---|---|
| Message-ID | <[email protected]> |
A bug was filed on Fedora because of the default behavior of Logwatch: the "mailto" configuration variable determines who receives the logwatch output. The default behavior for cron (or anacron) is for the user executing the program to receive the mail. If a program outputs to standard output, cron compiles it into a file and then mails the file. The Fedora version of cron also has a variable called MAILTO, which allows overrides. So I'd like to propose that we make the default to print to standard output, not email. We let cron deal with creating the email. So for a default distribution, you still get an email. When you execute it from a command line, you don't need to use "--print" to output to the terminal. The only difference would be that by default, the sender and subject of the email is not set by the user in logwatch.conf. Instead of 'Logwatch', the mail will appear to be sent by 'Cron Daemon', for example, with a cron- related subject. To revert to the old behavior, you can set Print = No in your /etc/logwatch/conf/logwatch.conf file. _______________________________________________ Logwatch-Devel mailing list [email protected] http://www2.list.logwatch.org:81/mailman/listinfo/logwatch-devel
logwatch.conf.patch
(text/x-patch, 864 B)
Index: logwatch.conf =================================================================== RCS file: /var/cvs/logwatch/conf/logwatch.conf,v retrieving revision 1.29 diff -u -r1.29 logwatch.conf --- logwatch.conf 28 Apr 2007 23:48:36 -0000 1.29 +++ logwatch.conf 29 Apr 2007 00:26:28 -0000 @@ -30,7 +30,8 @@ TmpDir = /var/cache/logwatch # Default person to mail reports to. Can be a local account or a -# complete email address. +# complete email address. Variable Print should be set to No to +# enable mail feature. MailTo = root # Default person to mail reports from. Can be a local account or a # complete email address. @@ -38,7 +39,7 @@ # If set to 'Yes', the report will be sent to stdout instead of being # mailed to above person. -Print = No +Print = Yes # if set, the results will be saved in <filename> instead of mailed # or displayed.
logwatch.pl.patch
(text/x-patch, 1.6 KB)
Index: logwatch.pl
===================================================================
RCS file: /var/cvs/logwatch/scripts/logwatch.pl,v
retrieving revision 1.187
diff -u -r1.187 logwatch.pl
--- logwatch.pl 23 Apr 2007 02:19:05 -0000 1.187
+++ logwatch.pl 29 Apr 2007 00:47:52 -0000
@@ -64,7 +64,7 @@
$Config{'mailto'} = "root";
$Config{'mailfrom'} = "Logwatch";
$Config{'save'} = "";
-$Config{'print'} = 0;
+$Config{'print'} = 1;
$Config{'range'} = "yesterday";
$Config{'debug'} = 0;
$Config{'archives'} = 1;
@@ -273,9 +273,6 @@
CleanVars();
-my $OldMailTo = $Config{'mailto'};
-my $OldPrint = $Config{'print'};
-
# For each of the configuration sets (logwatch.conf here, and
# logfiles,and services later), we do the following:
# 1. read the different configuration files
@@ -312,12 +309,6 @@
CleanVars();
-if ($OldMailTo ne $Config{'mailto'}) {
- $Config{'print'} = 0;
-} elsif ($OldPrint ne $Config{'print'}) {
- $Config{'mailto'} = "";
-}
-
if ($Config{'debug'} > 8) {
print "\nConfig After Config File:\n";
PrintConfig();
@@ -330,9 +321,6 @@
my $Help = 0;
my $ShowVersion = 0;
-$OldMailTo = $Config{'mailto'};
-$OldPrint = $Config{'print'};
-
GetOptions ( "d|detail=s" => \$Config{'detail'},
"l|logfile=s@" => \@TempLogFileList,
"logdir=s" => \$Config{'logdir'},
@@ -411,10 +399,8 @@
unlink "$Config{'save'}";
}
-if ($OldMailTo ne $Config{'mailto'}) {
- $Config{'print'} = 0;
-} elsif ($OldPrint ne $Config{'print'}) {
- $Config{'mailto'} = "";
+if ($Config{'mailto'} eq "") {
+ $Config{'print'} = 1;
}
if ($Config{'debug'} > 8) {