# Log rotation configuration for Black Canyon Tickets
# Copy this file to /etc/logrotate.d/bct on your server

/var/www/bct-whitelabel/logs/*.log {
    # Rotate daily
    daily
    
    # Keep 7 days of logs
    rotate 7
    
    # Compress old logs (saves disk space)
    compress
    
    # Don't compress the most recent rotated file
    delaycompress
    
    # Don't error if log file is missing
    missingok
    
    # Don't rotate empty files
    notifempty
    
    # Create new log file with specific permissions
    create 644 tyler tyler
    
    # Use date as suffix for rotated files
    dateext
    
    # Run commands after rotation
    postrotate
        # Send SIGUSR1 to Docker containers to reopen log files (if needed)
        # docker kill --signal=USR1 bct-astro 2>/dev/null || true
    endscript
}

# Docker container logs (optional)
/var/lib/docker/containers/*/*-json.log {
    daily
    rotate 7
    compress
    delaycompress
    missingok
    notifempty
    copytruncate
}