Audit Logging Policy
| Category | Security |
|---|---|
| Version | 1.0 |
| Status | Approved |
| Approved | 2026-03-25 by Mishkin Berteig |
| Next Review | 2027-03-25 |
| ID | POL-9 |
| Document version | policies/audit-logging.md at commit 5debdf12b05f (SHA-256 c164986fdd54) |
Linked Controls
- LOG-4 Security Event Logging
- LOG-3 Centralized Logging
- LOG-5 Security Event Review
Audit Logging Policy
Purpose
This policy establishes requirements for security event logging, centralized log management, and log review to ensure accountability, detect security incidents, and support forensic investigation across the MaxGood.work platform.
Scope
All MaxGood.work production systems, development tools, and AI agent sessions.
Security Event Logging
The following security events must be logged:
Application Events
- Authentication attempts (success and failure)
- Authorization failures (access denied)
- Account creation, modification, and deletion
- Password changes and resets
- OTC (One-Time Code) generation and validation
- Staff role assignments and removals (
staff_role.assigned,staff_role.removed,staff_role.change_refused), role-definition changes (staff_role_definition.changed), staff permission refusals (staff_permission.refused) and writes made under a narrow staff scope (staff_scoped_write) - Integration credential changes (user access grants and revocations for org integrations)
- Content management operations (upload, delete, update) — database records exist but currently lack user attribution and timestamps; improving this logging is a planned enhancement
Infrastructure Events
- AWS CloudTrail events (API calls across all services)
- ECS task start/stop events
- RDS connection and query audit logs — not currently enabled; enabling PostgreSQL connection and statement logging is a planned enhancement
- S3 bucket access logs — not currently enabled; enabling is a planned enhancement
- Security group changes
- IAM policy changes
AI Agent Events
- Session start and end
- Tool calls and their results
- File reads, writes, and edits
- Git operations (commit, push, branch)
- External API calls
- Governance file changes (CLAUDE.md, AGENTS.md)
- Sign-ins, permission refusals and writes of the AI support agent account, recorded as application events
Decision Log Capture
AI agent session transcripts are a formal logging requirement. The decision log system:
- Captures AI agent session transcripts (prompts, responses, tool calls — excluding internal thinking) via a SessionEnd hook. Prototyped and tested; rollout to all development environments is in progress
- Stores transcripts as JSONL files in
MGDataAndEvidence/decision-logs/ - Scopes capture to sessions under the workspace root only; personal projects in other directories are never logged
- Each session has a
.meta.jsonfile (session ID, working directory, timestamp) and a.jsonltranscript file - Decision logs are version-controlled in git and staged for ingestion into the compliance database
Decision logs serve as the authoritative record of what was discussed, decided, and implemented during each development session.
Centralized Logging
All logs are centralized through:
- AWS CloudWatch Logs — Application logs, infrastructure logs, and custom metrics for all ECS services
- AWS CloudTrail — API activity across the AWS account
- Git history — All code changes with structured commit messages
- MGDataAndEvidence — AI agent decision logs
Log Retention
| Log Type | Retention Period |
|---|---|
| CloudWatch application logs | 1 day for production ECS logs; 30 days by default for all others |
| CloudTrail events | 90 days (default event history) |
| RDS audit logs | 90 days |
| Decision logs (AI agent transcripts) | Indefinite (version-controlled) |
| Git commit history | Indefinite |
Security Event Review
The Security Officer reviews security events on the following schedule:
Within 24 Hours
- CloudWatch alarms and anomaly notifications
- Failed authentication attempts (patterns indicating brute force)
- Authorization failures (patterns indicating privilege escalation attempts)
Weekly
- The AI support agent account's
staff_permission.refusedandstaff_scoped_writerecords
Event-Driven
- Critical CloudTrail events (IAM changes, root account usage, security group modifications) trigger automated notifications via EventBridge and SNS, reviewed within 24 hours
Monthly
- Decision log review (sampling of AI agent sessions for governance compliance)
Ad-hoc
- Immediately upon security incident notification
- When investigating suspicious activity
- When onboarding or offboarding personnel
Log Protection
- Logs must not be modified or deleted outside of the defined retention policy
- CloudWatch logs are protected by IAM policies restricting delete access
- Decision logs in MGDataAndEvidence are protected by git version control
- Log access is restricted to the Security Officer and authorized DevOps personnel