好的,我做了一个嘘声。我认为
问题: Logrotate 失败(或者我错误地认为它已经死了)并且没有提供任何错误消息来解释原因:
● logrotate.service - Rotate log files
Loaded: loaded (/lib/systemd/system/logrotate.service; static; vendor preset: enabled)
Active: inactive (dead) since Fri 2021-12-31 13:05:25 CST; 42min ago
Docs: man:logrotate(8)
man:logrotate.conf(5)
Process: 27844 ExecStart=/usr/sbin/logrotate /etc/logrotate.conf (code=exited, status=0/SUCCESS)
Main PID: 27844 (code=exited, status=0/SUCCESS)
Dec 31 13:05:25 server1.example.com systemd[1]: Starting Rotate log files...
Dec 31 13:05:25 server1.example.com systemd[1]: logrotate.service: Succeeded.
Dec 31 13:05:25 server1.example.com systemd[1]: Started Rotate log files.
我想使用 systemd 自动重新启动 logrotate,因为有时它会在重新启动后失败。因此在我的/usr/lib/systemd/system/logrotate.service
文件中我添加了:
Restart=always
上面添加了kill logrotate服务。从那里我决定撤消我的肮脏工作并删除Restart=always
和systemctl daemon-reload && systemctl start logrotate
没运气。
然后我决定调查系统日志,看看是否能找到任何线索,使用:
#grep "logrotate" /var/log/syslog
。这产生了一个线索:
Dec 31 00:00:03 server1 systemd[1]: logrotate.service: Succeeded.
Dec 31 00:36:16 server1 clamd[3544]: Fri Dec 31 00:36:16 2021 -> ^File path check failure on: /var/tmp/systemd-private-2f8e6be5a16040adb29706b9e31ae841-logrotate.service-DbrlAK
Dec 31 00:37:31 server1 systemd[1]: logrotate.service: Succeeded.
Dec 31 12:51:17 server1 systemd[1]: logrotate.service: Succeeded.
Dec 31 13:00:58 server1 systemd[1]: logrotate.service: Succeeded.
Dec 31 13:05:25 server1 systemd[1]: logrotate.service: Succeeded.
注意:您看到“成功”的所有时间都是我手动尝试启动 logrotate。
我在这篇关于服务器故障的帖子中读到,这可能是由于 logrotate 试图访问var/log/
目录之外的日志而引起的。/var/log
而且我虽然这可能是我的问题,但是除了上面的系统日志错误之外,我找不到任何外部日志的指示:
重申:
Dec 31 00:36:16 server1 clamd[3544]: Fri Dec 31 00:36:16 2021 -> ^File path check failure on: /var/tmp/systemd-private-2f8e6be5a16040adb29706b9e31ae841-logrotate.service-DbrlAK
从我调查蛤蜊,但是
#grep "log" /etc/clamav/clamd.conf
LogSyslog false
LogFile /var/log/clamav/clamav.log
收益,什么都没有。有谁知道为什么 logrotate 不会启动?