/opt/osstech/var/log/unicornidm/unicornidm.log
{
    olddir old
    missingok
    notifempty
    rotate 27
    weekly
    # Delay compression of the youngest rotated log file because
    # old processes (uWSGI workers) may continue to write logs to
    # it until gracefully restarted.
    delaycompress
    # This log file is reopend by Python logging.handlers.WatchedFileHandler
    # when a new log message is arrived after rotation.
}

/opt/osstech/var/log/unicornidm/uwsgi.log
{
    olddir old
    missingok
    notifempty
    create
    rotate 27
    weekly
    delaycompress
    # uWSGI's touch-logreopen option
    # http://uwsgi-docs.readthedocs.io/en/latest/Options.html#touch-logreopen
    postrotate
        touch /opt/osstech/var/log/unicornidm/uwsgi.reopentrigger
    endscript
}

/opt/osstech/var/log/unicornidm/mongod.log
{
    olddir old
    missingok
    notifempty
    create
    rotate 27
    weekly
    delaycompress
    postrotate
        if [ -s /var/opt/osstech/lib/unicornidm/mongod.pid ] && kill -0 `cat /var/opt/osstech/lib/unicornidm/mongod.pid` > /dev/null; then
            kill -USR1 `cat /var/opt/osstech/lib/unicornidm/mongod.pid` || true
        fi
    endscript
}
