大网数据广告活动
服务器运维问答

logrotate: What means the message "log has been already rotated"

· 52CE 我爱测

If I run logrotate I get log does not need rotating (log has been already rotated) and the log file is not rotated. Why that? My log rotate conf: /var/log/capp/*.log { missingok rotate 90 daily notifempty compress delaycompress }…

问题原文

原帖链接 · Steffen · CC BY-SA 4.0

If I run logrotate I get log does not need rotating (log has been already rotated) and the log file is not rotated. Why that?

My log rotate conf:

/var/log/capp/*.log {
    missingok
    rotate 90
    daily
    notifempty
    compress
    delaycompress
}

Before I run logrotate I remove the line

"/var/log/capp/server.log" 2019-4-1-7:0:0

from file /var/lib/logrotate/logrotate.status

logrotate output:

/> logrotate -v /etc/logrotate.d/capp 
reading config file /etc/logrotate.d/capp
Allocating hash table for state file, size 15360 B

Handling 1 logs

rotating pattern: /var/log/capp/*.log  after 1 days (90 rotations)
empty log files are not rotated, old logs are removed
considering log /var/log/capp/server.log
  log does not need rotating (log has been already rotated)

and the log file is not rotated:

/> ls -la  /var/log/capp/server.log*
-rw-r--r-- 1 capp capp 272962507  1. Apr 07:00 /var/log/capp/server.log

已采纳解答

原帖链接 · Steffen · CC BY-SA 4.0

May be logrotate will be only on the second run begin to rotate log files. Seems that if no entry for that file is in /var/lib/logrotate/logrotate.status logrotate will be not rotate the file. So the trick was for me to change in /var/lib/logrotate/logrotate.status the line

"/var/log/capp/server.log" 2019-4-1-7:0:0

to

"/var/log/capp/server.log" 2019-3-31-7:0:0

... and logrotate began to rotate the server.log file

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2019-04-01)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。