我已经通过今天在我的服务器上设置Logwatch,并成功安装了这一切。
我已经按照数字海洋上的这个指南 ,并将MailFrom参数设置为:
MailFrom = [email protected]
我正在使用ssmtp使用我的Postmark App帐户发送电子邮件,它正在通过我的邮戳活动源,但是它显示的From字段被设置为root。
[email protected]的SMTP API错误:无效的“发件人”地址:“root”。
看看试图发送的电子邮件的原始来源,它显示了这一行:
From: root
这是我用来生成发送的命令:
sudo logwatch --detail Low --mailto [email protected] --service http --range today
我在哪里错了,或者我能做些什么才能将它作为[email protected]作为邮戳发送,要求发送地址被正确发送,否则将不允许发送并返回错误
更多细节
Logwatch版本: Logwatch 7.4.0 (released 03/01/11)
系统:Debian 8(Jessie)
在我的服务器上使用sSMTP从邮戳debugging日志发送邮件:
Config After Command Line Parsing: supress_ignores -> 0 pathtozcat -> zcat html_header -> /usr/share/logwatch/default.conf/html/header.html logdir -> /var/log hostlimit -> encode -> none subject -> mailfrom -> root format -> html numeric -> 0 tmpdir -> /tmp html_wrap -> 80 pathtobzcat -> bzcat detail -> 0 range -> yesterday hostformat -> none debug -> 10 output -> mail mailer -> /usr/sbin/sendmail -t hostname -> game html_footer -> /usr/share/logwatch/default.conf/html/footer.html archives -> 1 pathtocat -> cat mailto -> [email protected] filename ->
经过一番调查,我追查了原因。
Logwatch在处理/usr/share/logwatch/dist.conf/logwatch.conf后处理/usr/share/logwatch/default.conf/logwatch.conf 。
里面的/usr/share/logwatch/dist.conf/logwatch.conf是三个configuration行:
mailer TmpDir MailFrom 在这里, MailFrom被设置为root ,这是导致问题。 更新到[email protected]它一切正常!
不幸的是,数字海洋的文章是一个重要的点误导。 在编辑之前,应将logwatchconfiguration文件复制(参见https://help.ubuntu.com/community/Logwatch )成为/etc/logwatch/conf/logwatch.conf。 如果在/ etc位置有一个configuration文件,logwatch将优先考虑/ etc文件的默认值(甚至忽略默认值,我不知道是哪个)。 这是在文章下面的评论中提到的,但是和你一样,在继续执行之前,我没有阅读这些评论。 这就是我在这里完成的!
您应该在/etc/logwatch/conf/logwatch.conf设置您的configuration。
这会覆盖/usr/share/logwatch/dist.conf/logwatch.conf和/usr/share/logwatch/default.conf/logwatch.conf 。
从http://ftp.logwatch.org/tabs/docs/HOWTO-Customize-LogWatch.html
但是,从7.0版开始,Logwatch实现了一种机制,可以更轻松地修改本地系统。 可能需要进行这些修改,因为写入系统日志的服务configuration已从其默认设置改变,或者因为Logwatch用户更喜欢Logwatch报告的内容或报告方式不同。
您可以通过修改/ etc / logwatch / conf目录中的variables来自定义logwatch的输出。
缺省值在/usr/share/logwatch/default.conf目录中指定。 您的发行版可能在/usr/share/logwatch/dist.conf目录中设置了其他默认值。 所有可用的variables都在这些目录下的文件中声明。 您可以更改默认值以修改使用logging表显示的内容或内容。