/var/log/yandex/passport-grants-configurator/*.log
/var/log/nginx/*.log
{
    daily
    missingok
    create 0644 www-data www-data
    rotate 7
    compress
    delaycompress
    notifempty
    sharedscripts
    dateext
    dateformat .%Y%m%d

    prerotate
        echo "[`date +'%H:%M:%S'`] Starting rotate"

        TTS=$(($RANDOM*60*30/32767))
        echo "[`date +'%H:%M:%S'`] Sleep before start: ${TTS}"

        /bin/sleep $TTS
    endscript

    postrotate
        echo "[`date +'%H:%M:%S'`] Restarting services"

        /etc/init.d/nginx restart
        ubic restart passport_admin_roles_gunicorn
        ubic restart passport_grants_configurator_gunicorn
        ubic restart passport_grants_configurator_upravlyator_gunicorn

        echo "[`date +'%H:%M:%S'`] Logrotate completed"
    endscript
}
