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

Logrotate not rotating file after file size exceeds the limit.

· 52CE 我爱测

From logrotate manpage. It will not modify a log more than once in one day unless the criterion for that log is based on the log's size According to the man page, logrotate should rotate file if the configuration is based on logs…

问题原文

原帖链接 · robert · CC BY-SA 3.0

From logrotate manpage.

It will not modify a log more than once in one day unless the criterion for that log is based on the log's size

According to the man page, logrotate should rotate file if the configuration is based on logs size. But, my file is not getting even if the filesize if greater than 100k.

Can somebody point out what is the issue.

My configuration

/home/jetech/work/lampstack-5.3.9-0/apache2/logs/access_log  {
    copytruncate
    compress
#    dateext
    rotate 365
    size 100k
    olddir /home/jetech/work/lampstack-5.3.9-0/apache2/old_logs
    notifempty
    nomail
    missingok
}

已采纳解答

原帖链接 · cnst · CC BY-SA 3.0

How do you know the file is not getting rotated?

On a Debian 6 Linode I have, in the default configuration logrotate was only scheduled by cron to run once per day, and at a very odd time at that. If only run once per day, naturally it'll only have one opportunity per day to look at the configuration, do the comparisons and perform the rotations required.

So, are you sure you're actually running your logrotate? Might want to check your /etc/cron* and /etc/cron*/* to see when and how often logrotate is scheduled to run.

For example, if logrotate script is present in /etc/cron.daily, then you may want to move it to /etc/cron.hourly, or, if hourly is not good enough, create a file in /etc/cron.d/ with the following content, to run logrotate every 10 minutes:

*/10  *  *  *  *   root    /usr/sbin/logrotate /etc/logrotate.conf

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

资料来源与适用范围

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

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

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