Data Retention
Rack Gateway stores audit logs in PostgreSQL and can write WORM anchors to S3 for tamper-evident retention. The gateway does not automatically delete audit logs; retention policies are enforced by operators.
Retention Overview
Section titled “Retention Overview”- Primary storage: PostgreSQL (
audit.audit_event) - WORM anchors: Optional S3 Object Lock bucket
PostgreSQL Retention
Section titled “PostgreSQL Retention”Audit logs remain in PostgreSQL until you delete them. For compliance-sensitive environments, retain logs long enough to satisfy your audit requirements.
If you choose to prune logs manually, use the timestamp column in
audit.audit_event and ensure you remain compliant with your policy.
S3 WORM Anchors
Section titled “S3 WORM Anchors”WORM anchors capture the chain head hash and metadata, not full log exports. Anchors are written periodically (default: hourly) to an Object Lock bucket.
Environment Configuration
Section titled “Environment Configuration”# Enable anchorsAUDIT_ANCHOR_BUCKET=rack-gateway-audit-anchor-productionAUDIT_ANCHOR_CHAIN_ID=productionAUDIT_ANCHOR_RETENTION_DAYS=400
# OptionalAUDIT_ANCHOR_INTERVAL_MINUTES=60AWS_REGION=us-east-1AWS_ENDPOINT_URL_S3=http://minio:9000 # for MinIOAnchor Workflow
Section titled “Anchor Workflow”-
Compute chain head
- Gateway reads the latest
audit.audit_eventhash
- Gateway reads the latest
-
Write anchor payload
- JSON payload written to S3 with Object Lock retention
-
Verify externally
- Use the stored hash to validate the chain later
Terraform Example (S3 WORM)
Section titled “Terraform Example (S3 WORM)”resource "aws_s3_bucket" "audit_anchor" { bucket = "rack-gateway-audit-anchor-${var.environment}" versioning { enabled = true } object_lock_configuration { object_lock_enabled = "Enabled" }}
resource "aws_s3_bucket_object_lock_configuration" "audit_anchor" { bucket = aws_s3_bucket.audit_anchor.id rule { default_retention { mode = "COMPLIANCE" days = 400 } }}