# /etc/logrotate.d/passkeeper
#
# Install:
#   sudo cp scripts/passkeeper-logrotate /etc/logrotate.d/passkeeper
#   sudo logrotate -d /etc/logrotate.d/passkeeper   # dry-run to verify
#   sudo logrotate -f /etc/logrotate.d/passkeeper   # force a rotation now
#
# Rotates Gunicorn access and error logs daily, retaining 30 days.
# Sends USR1 to Gunicorn after rotation so it reopens its log file handles
# without a full restart (zero downtime).

/home/spuser/logs/access.log
/home/spuser/logs/error.log {
    daily
    rotate 30
    compress
    delaycompress
    missingok
    notifempty
    create 0640 www-data www-data
    sharedscripts
    postrotate
        # Signal Gunicorn to reopen log files
        systemctl kill -s USR1 passkeeper.service 2>/dev/null || true
    endscript
}
