Skip to content

Audit Logging

Audit logging creates a permanent record of all actions taken in a system. These logs serve multiple purposes: security forensics, compliance evidence, and operational visibility. Effective audit logs answer the questions: Who did what, when, and what was the outcome?

When a security incident occurs, audit logs are essential for:

  • Determining scope: What was accessed?
  • Identifying attackers: Who performed the actions?
  • Understanding timeline: When did the breach begin and end?
  • Assessing damage: What changes were made?

Regulatory frameworks mandate audit logging:

FrameworkAudit Requirements
SOC 2Log access to customer data, retain for defined period
HIPAALog access to protected health information
PCI DSSLog all access to cardholder data
GDPRDocument processing activities
ISO 27001Event logging and monitoring

Beyond security, audit logs provide:

  • Change tracking: Who modified configuration?
  • Troubleshooting: What happened before the outage?
  • Usage patterns: How is the system being used?
  • Accountability: Who approved this deployment?

A complete audit log entry captures:

{
"timestamp": "2024-01-15T14:30:45.123Z",
"event_type": "convox.releases.promote",
"actor": {
"type": "user",
"id": "user_123",
"email": "alice@example.com",
"ip_address": "192.168.1.100",
"user_agent": "rack-gateway-cli/1.2.0"
},
"action": {
"method": "POST",
"path": "/apps/myapp/releases/R123/promote",
"parameters": {
"app": "myapp",
"release_id": "R123"
}
},
"outcome": {
"status": "success",
"response_code": 200
},
"context": {
"rack": "production",
"session_id": "sess_abc123",
"request_id": "req_xyz789"
}
}
FieldPurposeExample
timestampWhen the event occurredISO 8601 format
event_typeWhat kind of eventconvox.apps.create
actorWho performed the actionUser email, IP address
actionWhat was doneHTTP method, path, parameters
outcomeWhat happenedSuccess/failure, status code
FieldPurpose
session_idLinks multiple actions
request_idTraces through distributed systems
user_agentClient identification
changesBefore/after values

Logs often contain sensitive data:

{
"action": "env.set",
"parameters": {
"DATABASE_URL": "postgres://user:password@host/db",
"API_KEY": "sk_live_abc123secret"
}
}

This creates risk:

  • Logs may be accessed by support staff
  • Log aggregation services may store data externally
  • Breached logs expose credentials

Rack Gateway automatically redacts sensitive data:

{
"action": "env.set",
"parameters": {
"DATABASE_URL": "[REDACTED]",
"API_KEY": "[REDACTED]"
}
}
PatternExamples
Passwordspassword, passwd, db_password
Secretssecret, secret_key, client_secret
Tokenstoken, api_token, access_token
Keysapi_key, private_key, encryption_key
Connection stringspostgres://..., mysql://...

If attackers can modify logs, they can:

  • Delete evidence of their access
  • Alter timestamps to confuse investigations
  • Remove their user from logged actions
  • Make it appear another user was responsible

Write-Once Storage (WORM)

Rack Gateway supports S3 Object Lock for tamper-evident logs:

Cryptographic Chaining

Each anchor includes a hash of the previous anchor:

Anchor 1: hash(logs_1_100) | prev_hash: null
Anchor 2: hash(logs_101_200) | prev_hash: hash(anchor_1)
Anchor 3: hash(logs_201_300) | prev_hash: hash(anchor_2)

This creates a verifiable chain:

  • Any modification breaks the chain
  • Deletion is detectable
  • Sequence is provable
Terminal window
# Verify audit chain integrity
rack-gateway admin audit verify --from 2024-01-01 --to 2024-01-31
Verified 45 anchors
Chain integrity confirmed
No gaps detected
FactorConsideration
ComplianceSOC 2 typically requires 1 year
LegalPotential litigation may require 7+ years
InvestigationIncidents may not be discovered for months
CostStorage costs increase with retention

Rack Gateway default: 400 days (exceeds most compliance requirements)

Terminal window
# Environment variable
LOG_RETENTION_DAYS=400
# For S3 WORM
WORM_RETENTION_DAYS=400 # Objects locked for this period

Flow:

  1. Audit middleware captures request details
  2. Request processed by handler
  3. Response captured (success/failure)
  4. Log entry written to database
  5. Periodic job creates anchors in S3 WORM
Event TypeDetails Captured
AuthenticationLogin attempts, OAuth callbacks
SessionSession creation, expiration, logout
MFAEnrollment, verification, removal
Convox APIAll proxied requests and responses
Admin ActionsUser management, role changes
API TokensCreation, deletion, usage
SettingsConfiguration changes
  • Health check requests (/api/v1/health)
  • Static asset requests
  • Actual response bodies (only status codes)
  • Sensitive field values (redacted)

Access audit logs through the web interface:

  • Filter by user, time range, event type
  • Export to CSV for external analysis
  • View detailed JSON for each entry
Terminal window
# Get recent audit logs
curl https://gateway.example.com/api/v1/admin/audit \
-H "Authorization: Bearer $TOKEN" \
-d '{"from": "2024-01-01", "to": "2024-01-31"}'
Terminal window
# View recent logs
rack-gateway admin audit list --limit 100
# Filter by user
rack-gateway admin audit list --user alice@example.com
# Filter by event type
rack-gateway admin audit list --type convox.releases.promote
  1. Log everything

    It’s better to have logs you don’t need than to need logs you don’t have

  2. Redact automatically

    Don’t rely on developers to remember—use pattern-based redaction

  3. Use structured logging

    JSON format enables querying and analysis

  4. Include context

    Request IDs, session IDs, and correlation IDs help trace actions

  5. Store immutably

    Use WORM storage to prevent tampering

  6. Retain adequately

    Meet compliance requirements with margin for safety

  7. Monitor the logs

    Logs are useless if no one watches them

  8. Test your logging

    Verify logs capture what you need before an incident

SOC 2 CriteriaAudit Log Support
CC6.1All access logged with user attribution
CC7.1Configuration changes logged
CC7.2Security events captured
A1.2Log integrity via WORM anchoring

Auditors typically request:

  1. Evidence of logging: Screenshot of log entries
  2. Retention policy: Documentation of retention settings
  3. Access controls: Who can view/modify logs
  4. Integrity: Evidence of WORM storage configuration

Rack Gateway provides:

  • Audit log viewer in web UI
  • WORM bucket configuration documentation
  • RBAC for log access (admin only)
  • Verification command for chain integrity
  1. Audit logs are essential for security, compliance, and operations
  2. Automatic redaction protects sensitive data in logs
  3. Immutable storage prevents evidence tampering
  4. Cryptographic chaining enables integrity verification
  5. Retention policies must meet compliance requirements
  6. Structured logs enable effective querying and analysis