Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I fix "/etc/cron.daily/logrotate: gzip: stdin: file size changed while zipping"?

Tags:

in last days i get daily mail from cron's logrotate task:

/etc/cron.daily/logrotate:

gzip: stdin: file size changed while zipping

How can I fix it?

Thanks, Gian Marco.

like image 660
Kiuki Avatar asked Jul 01 '15 07:07

Kiuki


1 Answers

Here's a blog post in French which gives a solution.

In English, you can read this bug report.

To summarise:

  1. First you have to add the --verbose option in the script /etc/cron.daily/logrotate to have more information the next time it runs to identify which rotation log cause the problem.

    #!/bin/sh  test -x /usr/sbin/logrotate || exit 0 /usr/sbin/logrotate --verbose /etc/logrotate.conf` 
  2. Next you have to add the delaycompress option in logrotate configuration.

    Like exemple, I add the nginx's logrotate configiguration in /etc/logrotate.d/nginx:

    /var/log/nginx/*.log {     daily     missingok     rotate 14     compress     delaycompress     notifempty     create 0640 www-data adm     sharedscripts     ... } 
like image 138
lamanux Avatar answered Sep 22 '22 17:09

lamanux