我logrotate
在 EC2 AWS 机器上运行旋转 Apache 日志。打包后,Apache 日志将通过 s3fs 保存到 AWS S3 中。问题是我最近注意到我没有轮换日志。在 S3 中,我有 48->60 天的旧日志,但 1->47 没有出现。
我的问题是:logrotate 在哪里保存自己的日志?我可能对 s3fs 有某种问题,但在我做任何事情之前我需要知道。我试图在某处找到日志,但找不到。
任何的想法?
joh*_*n64 29
logrotate
默认情况下不记录任何内容。通常它应该在你的 cron 中的某个地方,例如:
$ grep -r -- 'logrotate.conf' /etc/cron*
/etc/cron.daily/logrotate:/usr/sbin/logrotate /etc/logrotate.conf
Run Code Online (Sandbox Code Playgroud)
您可以手动运行以查看错误,或者将 logrotate 输出重定向到上述 cron 中的文件以查看第二天发生的情况。
可能某处配置不正确并导致 logrotate 运行中断。
dra*_*788 17
logrotate 记录的唯一正常情况是在cat /var/lib/logrotate/status
.
这是摘自https://serverfault.com/a/518134/266525
另一个/var/log/messages
值得查看的好地方是CentOS 上的错误,例如来自 cron.daily 的错误/etc/cron.daily/logrotate
logrotate: ALERT exited abnormally with [1]
Run Code Online (Sandbox Code Playgroud)
您还可以手动在调试模式下运行并检查错误:
/usr/sbin/logrotate -d /etc/logrotate.conf
Run Code Online (Sandbox Code Playgroud)
来源:https : //access.redhat.com/solutions/32831