/var/log/nginx/*.log
/var/log/yandex/passport-historydb-api/*.log
/var/log/yandex/passport-historydb-api2/*.log
{
    daily
    rotate 7
    compress
    delaycompress
    missingok
    create 644 www-data www-data
    sharedscripts
    prerotate
        /bin/sleep $[RANDOM % 3600]
    endscript
    postrotate
        pkill -HUP historydb_api2

        chmod 0000 /usr/lib/yandex/passport-historydb-api/ping.html
        sleep 60

        [ ! -f /var/run/nginx.pid ] || kill -USR1 `cat /var/run/nginx.pid`
        service yandex-passport-historydb-api restart > /dev/null

        sleep 120
        chmod 0644 /usr/lib/yandex/passport-historydb-api/ping.html
    endscript
}
