我为日志的日志旋转设置了以下参数。 size=10M , rotate 800 , copytruncate , missingok 。 800个正在旋转的文件正在创build,但其中许多都在10M以下,其中一些是空的,大小为0。
我有一个cron设置为* * * * * ,它运行每分钟做这个logrotation。 我不想要这个,不明白为什么会这样。
试试这个选项:
notifempty Do not rotate the log if it is empty (this overrides the ifempty option).
资料来源: http : //linux.die.net/man/8/logrotate
即使我有相同的问题,添加“nocreate”选项问题后解决。
/opt/postgres/9.1/data/pg_log/postgresql*.log { missingok compress daily rotate 7 maxage 7 minsize 5 notifempty size 5M nocreate }