我必须在其他系统网络管理配置的服务器上配置 logrotate。首先,我检测到没有 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
不存在。
答案1
你告诉它不要这么做。从man
logrotate 页面上可以看到:
-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
”。