Rotating a log by renaming the file leaves the writing process holding a handle to the renamed inode, so it keeps writing to a file nobody is looking at until it is restarted.
/var/log/app/*.log {
daily
rotate 14
compress
delaycompress
missingok
notifempty
create 0640 www-data adm
sharedscripts
postrotate
systemctl reload php7.2-fpm > /dev/null 2>&1 || true
endscript
}
The postrotate reload is what reopens the handle, and without it the new log file stays empty. copytruncate is the alternative for a process that cannot be signalled, and it has a real race — anything written between the copy and the truncate is lost. delaycompress matters when the process writes for a moment after rotation: compressing yesterday’s file a day late avoids compressing a file still being appended to.