我必须在由其他系统-网络管理机构配置的服务器上配置日志旋转。首先,我检测到没有crond,所以我不得不安装sudo yum install vixie-cron。所有其他设置似乎都可以,/etc/cron.daily/logrotate文件存在。接下来,我运行sudo logrotate -d -f logrotate.conf来检查它是如何工作的。在执行结束时,我看到如下情况:
rotating pattern: /var/log/btmp forced from command line (1 rotations)
empty log files are rotated, old logs are removed
considering log /var/log/btmp
log needs rotating
rotating log /var/log/btmp, log->rotateCount is 1
dateext suffix '-20131004'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
glob finding old rotated logs failed
renaming /var/log/btmp to /var/log/btmp-20131004
creating new /var/log/btmp mode = 0600 uid = 0 gid = 22但是,在/var/log/btmp大小相同的情况下,不会发生任何事情,而且/var/log/btmp-20131004也不存在。
发布于 2013-10-04 07:50:46
你叫它不要的。在日志旋转上的man页面中:
-d, --debug Turns on debug mode and implies -v. In debug mode, no changes will be made to the logs or to the logrotate state file.
注意"no changes will be made to the logs“。
https://serverfault.com/questions/543743
复制相似问题