-
-
Notifications
You must be signed in to change notification settings - Fork 870
[Fix #4682] Implement Log retention policies #4712
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #4712 +/- ##
==========================================
+ Coverage 72.93% 76.50% +3.57%
==========================================
Files 83 21 -62
Lines 5368 3660 -1708
==========================================
- Hits 3915 2800 -1115
+ Misses 1453 860 -593
... and 74 files with indirect coverage changes
... and 74 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
c53fbca
to
c4f8494
Compare
c4f8494
to
df96aed
Compare
The AWS retention management system implemented for #4682 provides automated log retention policies for CloudWatch logs and submission artifact cleanup. It consists of:
Core Components
Backend Models
Challenge Model Fields
retention_policy_consent
: Boolean flag indicating host consentretention_policy_consent_date
: When consent was providedretention_policy_consent_by
: User who provided consentretention_policy_notes
: Optional notes about retention policylog_retention_days_override
: Admin override for retention periodSubmission Model Fields
retention_eligible_date
: When submission becomes eligible for deletionis_artifact_deleted
: Flag indicating if artifacts were deletedartifact_deletion_date
: Timestamp of deletionretention_policy_applied
: Description of applied policyretention_override_reason
: Reason for any overridesAPI Endpoints
Retention Consent Management
POST /challenges/{challenge_pk}/retention-consent/
- Provide consentGET /challenges/{challenge_pk}/retention-consent-status/
- Get consent statusPOST /challenges/{challenge_pk}/update-retention-consent/
- Update consentGET /challenges/{challenge_pk}/retention-info/
- Get comprehensive retention infoFrontend Implementation
Challenge Controller (
challengeCtrl.js
)fetchRetentionConsentStatus()
: Loads current consent statustoggleRetentionConsent()
: Shows confirmation dialog and handles consent toggleactuallyToggleRetentionConsent()
: Makes API call to update consentUI Components (as shown in video)
Screen-2025-07-22-015448.1.mp4
Celery Tasks
Scheduled Tasks (Celery Beat)
cleanup_expired_submission_artifacts()
retention_eligible_date <= now()
is_artifact_deleted
flagweekly_retention_notifications_and_consent_log()
update_submission_retention_dates()
AWS Integration
CloudWatch Log Retention
set_cloudwatch_log_retention()
: Sets CloudWatch log retention policylog_retention_days_override
Automatic Triggers
Signals and Automation
Django Signals
update_submission_retention_on_phase_change
: Updates retention dates when phase changesset_submission_retention_on_create
: Sets initial retention date for new submissionsRetention Calculation
User Consent Flow :
Data Safety :
manage_retention.py Script
Overview
A command-line utility for managing retention policies and performing cleanup operations.
Usage
Commands
cleanup [--dry-run]
Purpose: Clean up expired submission artifacts
Options:
--dry-run
: Show what would be cleaned without actually deletingExample:
Functionality:
cleanup_expired_submission_artifacts
Celery taskstatus [--challenge-id <id>]
Purpose: Show retention status for challenges
Options:
--challenge-id <id>
: Show status for specific challengeExample:
Output:
set-retention <challenge_id> [--days <days>]
Purpose: Set CloudWatch log retention for a challenge
Parameters:
challenge_id
: ID of the challenge--days <days>
: Optional custom retention periodExample:
Functionality:
consent <challenge_id> <username>
Purpose: Record retention consent for a challenge
Parameters:
challenge_id
: ID of the challengeusername
: Username of the person providing consentExample:
docker-compose exec django python scripts/manage_retention.py consent 123 john_doe
Functionality: