Skip to content

Audit Trail

Rack Gateway maintains a complete audit trail of all actions, providing the evidence needed for compliance audits and security investigations.

Every API request generates an audit log entry:

{
"ts": "2024-01-15T10:30:00Z",
"user_email": "developer@example.com",
"user_name": "Alice Developer",
"api_token_name": "ci-deploy",
"action_type": "convox",
"action": "deploy.create",
"resource": "myapp",
"resource_type": "app",
"command": "releases promote RABCDEF",
"status": "success",
"rbac_decision": "allow",
"http_status": 200,
"latency_ms": 1250,
"ip_address": "192.168.1.100",
"user_agent": "rack-gateway/1.0.0",
"request_id": "req-uuid-1234"
}
FieldDescriptionExample
tsTimestamp (UTC, RFC3339)2024-01-15T10:30:00Z
user_emailUser’s email addressalice@example.com
user_nameUser’s display nameAlice Developer
api_token_nameToken name (if used)ci-deploy
action_typeCategory: convox, auth, users, tokens, adminconvox
actionSpecific actiondeploy.create, user.create
resourceTarget resourcemyapp
resource_typeResource categoryapp, build, release
commandFull command executedreleases promote RABCDEF
statusOutcomesuccess, denied, error
rbac_decisionAccess decisionallow, deny
http_statusHTTP response code200, 403, 500
latency_msRequest duration1250
ip_addressClient IP192.168.1.100
user_agentClient identifierrack-gateway/1.0.0
request_idUnique request IDreq-uuid-1234

Sensitive data is automatically redacted before logging:

PatternExampleRedacted As
Secrets/tokens/passwordsPASSWORD=hunter2PASSWORD=[REDACTED]
Auth headers/cookiesAuthorization: Bearer ...[REDACTED]
API/client secretsCLIENT_SECRET=...[REDACTED]
// Built-in redaction patterns
var redactPatterns = []string{
`(?i)(secret|token|password|key|authorization|cookie|set-cookie|session)`,
`(?i)(api[-_]?key|api[-_]?secret|client[-_]?secret)`,
`(?i)(bearer|jwt|auth)`,
}

Audit logs are stored in PostgreSQL under the audit.audit_event table. The table is append-only and protected by row-level security to prevent tampering.

Logs are also written to stdout in structured JSON format for CloudWatch ingestion:

  • Real-time streaming
  • CloudWatch Logs Insights queries
  • Integration with CloudWatch Alarms
  • Cross-account log aggregation

For compliance requirements, the gateway writes periodic anchors to S3 Object Lock. Anchors capture the chain head hash and metadata (not full log exports).

See Data Retention for S3 WORM configuration.

  1. Navigate to Audit Logs in the sidebar
  2. Use filters to narrow results:
    • User
    • Date range
    • Action type
    • RBAC decision (allow/deny)
  3. Click entries to view full details
  4. Export for compliance reports

For advanced queries, access the database directly:

SELECT
timestamp,
user_email,
action,
resource,
status,
rbac_decision
FROM audit.audit_event
WHERE timestamp > NOW() - INTERVAL '7 days'
ORDER BY timestamp DESC
LIMIT 100;
CategoryActions
AuthenticationLogin, logout, MFA verification
RBAC DecisionsAllow/deny for every request
DeploymentsBuild, promote, rollback
EnvironmentGet, set, unset variables
User ManagementCreate, update, delete, lock
Token ManagementCreate, delete tokens
SettingsConfiguration changes
CategoryWhat’s Redacted
Environment VariablesValues
API TokensToken strings
Build LogsSecrets in output
Request BodiesSensitive fields
CategoryReason
Health ChecksToo frequent, not useful
Static AssetsNo security value
Internal MetricsSystem-level only

Audit events can trigger notifications:

Configure Slack notifications for security events:

Terminal window
# Environment variable
SLACK_WEBHOOK_URL=https://hooks.slack.com/services/T.../B.../...

Events that trigger notifications:

  • Failed login attempts
  • RBAC denials
  • User account locks
  • Admin actions

Email notifications for critical events:

Terminal window
# Environment variables
POSTMARK_API_KEY=your-api-key
NOTIFICATION_EMAIL=security@example.com

Audit logs include integrity measures:

  1. Request ID: Unique, non-sequential identifier
  2. Timestamps: Server-generated, not client-provided
  3. User context: Extracted from verified session/token

For immutable storage:

  • Object Lock in Compliance mode
  • Minimum 7-year retention
  • Legal hold capability
  • SHA-256 checksums stored

Evidence for Common Criteria:

CriterionEvidence
CC6.1Access logs showing authentication
CC6.2RBAC decision logs
CC6.3Session management logs
CC7.1Configuration change logs
CC7.2Deploy and change logs

For incident response:

  1. Identify timeframe

    When did the incident occur?

  2. Find affected users

    SELECT DISTINCT user_email
    FROM audit_logs
    WHERE created_at BETWEEN '2024-01-15 00:00:00' AND '2024-01-16 00:00:00';
  3. Trace actions

    SELECT *
    FROM audit_logs
    WHERE user_email = 'suspect@example.com'
    ORDER BY created_at;
  4. Check for anomalies

    Unusual times, IPs, or action patterns

  5. Export evidence

    Full logs with request IDs for forensics

  • Hot storage (PostgreSQL): 90 days for fast queries
  • Cold storage (S3): 7+ years for compliance
  • Real-time (CloudWatch): 30 days for monitoring

Set up alerts for:

  • Multiple failed logins
  • High rate of RBAC denials
  • Admin actions outside business hours
  • Unusual deployment patterns
  • Daily: Security team reviews failed logins
  • Weekly: Review admin actions
  • Monthly: Full access review
  • Quarterly: Compliance report generation