I have done this for my installation and would like to share and ask for advise.
The file is /etc/logrotate.d/gitlab and has the following content:
invoke-rc.d gitlab restart > /dev/null
The tricky part is the restart, because the reload wasn't enough to make the running processes close and reopen the log files. This works well and the logs rotate as intended.
Logrotate runs daily by crontab. And I noticed that the message queues were left in unusable state after restart, so the email notifications stopped.
I found that stopping and starting sidekiq was enough to get it working again and then I went looking for the cause in the init.d script. It seems that running stop and start operations for sidekiq as background processes caused some kind of race condition.
So to fix this I removed the trailing '&' from the commands in lines 77 and 79:
sudo -u gitlab -H bash -l -c "mkdir -p $PID_PATH && $STOP_SIDEKIQ > /dev/null 2>&1 &"
sudo -u gitlab -H bash -l -c "mkdir -p $PID_PATH && $START_SIDEKIQ > /dev/null 2>&1 &"
Could anyone check if this problem can safely be fixed this way?
I will drop this issue and start using a different configuration, based on the following one, which does not require the application restart (see option copytruncate in logrotate manpage).
Fix not starting sidekiq process if "gitlab restart".
It needs to wait for completing STOP_SIDEKIQ before START_SIDEKIQ.