1

Some files are zipped to 1.gz

/var/log/apt/history.log.1.gz
/var/log/apt/term.log.1.gz
/var/log/mosquitto/mosquitto.log.1.gz
/var/log/mysql/error.log.1.gz

Some are not zipped, first the second level is to 2.gz

/var/log/apache2/access.log.1
/var/log/apache2/error.log.1
/var/log/apache2/other_vhosts_access.log.1
/var/log/dbconfig-common/dbc.log.1
/var/log/exim4/mainlog.1
/var/log/letsencrypt/letsencrypt.log.1

I get the errormessage sometimes in mail:

/etc/cron.daily/logrotate:
error: Compressing program wrote following message to stderr 
  when compressing log /var/log/mosquitto/mosquitto.log.1:
gzip: stdin: file size changed while zipping

because mosquitto appearently writes to the log while it is being rotated.

The rotate script is the default installed by debian:

/var/log/mosquitto/mosquitto.log {
    rotate 7
    daily
    compress
    size 100k
    nocreate
    missingok
    postrotate
            /usr/bin/killall -HUP mosquitto
    endscript
}

I also prefer the lastest log uncompressed.

2 Answers 2

2

I think I have found the solution: The other scripts contained the keyword

delayrotate

According to the man it will delay the compression by one cycle.

0

You are missing this vital option to avoid file changing while in the compression phase:

copytruncate
1
  • 1
    You have missed that I wanted the 1. rotation uncompressed.
    – Lenne
    Dec 13, 2017 at 7:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .