logwatch文档说该LogFile
命令可以处理绝对路径。因此,我在 /etc/logwatch/conf/services 中有一个 celery.conf 文件,如下所示:
Title = "Watchdog Celery worker errors"
LogFile = /var/log/208-celery.log
LogFile = /var/log/234-celery.log
LogFile = /var/log/403-celery.log
LogFile = /var/log/dev-celery.log
(目的是将四个指定的日志文件组合成一个组用于 logwatch。)
我收到此错误:
*** Error: There is no logfile defined. Do you have a /etc/logwatch/conf/logfiles//var/log/208-celery.log.conf file ?
*** Error: There is no logfile defined. Do you have a /etc/logwatch/conf/logfiles//var/log/234-celery.log.conf file ?
*** Error: There is no logfile defined. Do you have a /etc/logwatch/conf/logfiles//var/log/403-celery.log.conf file ?
*** Error: There is no logfile defined. Do you have a /etc/logwatch/conf/logfiles//var/log/dev-celery.log.conf file ?
Can't open: /usr/share/logwatch/scripts/services/celery at /usr/sbin/logwatch line 1329.
LogFile
由于某种原因,logwatch 似乎没有将命令解释为绝对路径。我已经确认那些日志文件肯定存在于这些路径中。至于“无法打开...”错误——我的猜测是,由于缺少有效的 LogFile 命令,logwatch 正在寻找默认配置。
那么:如何让 logwatch 正确地观看那些特定的日志文件?
注意:我使用的是在 Ubuntu 12.04.4 LTS 上运行的 logwatch v7.4.0。
下配置文件中的
LogFile
条目services
是指在相应配置文件下定义的日志文件组logfiles
。有关配置日志文件组的信息,请参阅您链接到的文档的 A 部分...services
B 节用于在...下的配置文件中引用这些组该错误
/usr/share/logwatch/scripts/services/celery
是因为您没有按照文档 C 部分的说明创建服务过滤器可执行文件。/etc/logwatch/scripts/services
您应该在确保它是可执行的情况下创建它(使用示例脚本) 。我刚刚尝试过这个(CentOS 7.2 上的 logwatch 7.4.0,它按预期工作。