Logging Architecture
Plan centralized logging, retention, and audit trail design for "$ARGUMENTS". Define log sources, standardize formats, design aggregation infrastructure, and establish retention policies aligned with compliance requirements.
Prerequisites
Read .metapowers/security/$ARGUMENTS/00-govern.md. If this file does not exist, tell the user:
Phase 0 (Govern) has not been completed for "$ARGUMENTS". Run a Govern skill first (e.g., /security:security-policy $ARGUMENTS), or use --skip-checks to bypass.
If --skip-checks is present in $ARGUMENTS, skip this check and log to .metapowers/security/$ARGUMENTS/skip-log.md.
Process
Define log sources:
- Application logs — request/response logs, business logic events, error logs
- Infrastructure logs — server logs, container logs, load balancer logs, CDN logs
- Security tool logs — WAF, IDS/IPS, endpoint protection, vulnerability scanners
- Cloud provider logs — CloudTrail, Azure Activity Log, GCP Audit Logs, VPC flow logs
- Database logs — query logs, slow query logs, access logs, replication logs
- Identity provider logs — authentication events, token issuance, MFA events
Standardize log format:
- Adopt structured logging format (JSON recommended)
- Define mandatory fields: timestamp (ISO 8601 UTC), service name, environment, log level, correlation ID, user ID (when applicable), source IP
- Implement correlation IDs across service boundaries for request tracing
- Sanitize logs to prevent sensitive data in log entries (PII, credentials, tokens)
- Define log level conventions (ERROR, WARN, INFO, DEBUG) with usage guidelines
Design centralized log aggregation:
- Evaluate aggregation platforms (ELK/OpenSearch, Splunk, CloudWatch Logs, Datadog, Sumo Logic)
- Design collection architecture (agents, sidecars, log forwarding, direct API ingestion)
- Plan for log volume estimation and capacity planning
- Implement log parsing and enrichment (geo-IP, threat intelligence lookup)
- Design search and query capabilities for incident investigation
Define retention policy:
- Security logs — 1 year minimum (authentication, authorization, access control events)
- Audit logs — 7 years for compliance (SOX, PCI DSS, HIPAA as applicable)
- Application logs — 90 days hot storage, 1 year cold storage
- Infrastructure logs — 30 days hot storage, 6 months cold storage
- Define storage tiers (hot/warm/cold/archive) with cost optimization
- Set automated lifecycle policies for tier transitions and deletion
Protect log integrity:
- Store logs in immutable storage (write-once, read-many) for audit trail
- Implement checksums or digital signatures for log entries
- Restrict access to log data (separate from application access controls)
- Ensure log deletion requires multi-party approval
- Design tamper-evident log chains for high-security requirements
Define access control for log data:
- Restrict log access by role (security team: full access, developers: own service logs, auditors: read-only)
- Implement PII masking in log views for non-privileged users
- Audit log access itself (who searched what, when)
- Define self-service log access for developers within guardrails
Write the artifact to .metapowers/security/$ARGUMENTS/03-detect.md with heading:
Logging Architecture
Include sections:
- Log Sources — all sources with type, volume estimate, and sensitivity
- Log Format Standard — mandatory fields, correlation ID strategy, and sanitization rules
- Aggregation Architecture — platform selection, collection design, and capacity plan
- Retention Policy — retention periods by log type with storage tier strategy
- Log Integrity — immutability, checksums, and tamper protection measures
- Access Control — role-based log access and PII masking approach
Output
The logging architecture written to .metapowers/security/$ARGUMENTS/03-detect.md. Present a summary to the user highlighting:
- Log sources to be aggregated and estimated volume
- Chosen aggregation platform and architecture
- Retention periods by log type and compliance alignment
- Log integrity and access control measures
1---2name: logging-architecture3description: Plan centralized logging, retention, and audit trail design4---56# Logging Architecture78Plan centralized logging, retention, and audit trail design for "$ARGUMENTS". Define log sources, standardize formats, design aggregation infrastructure, and establish retention policies aligned with compliance requirements.910## Prerequisites1112Read `.metapowers/security/$ARGUMENTS/00-govern.md`. If this file does not exist, tell the user:1314> Phase 0 (Govern) has not been completed for "$ARGUMENTS". Run a Govern skill first (e.g., `/security:security-policy $ARGUMENTS`), or use `--skip-checks` to bypass.1516If `--skip-checks` is present in $ARGUMENTS, skip this check and log to `.metapowers/security/$ARGUMENTS/skip-log.md`.1718## Process19201. **Define log sources:**21 - **Application logs** — request/response logs, business logic events, error logs22 - **Infrastructure logs** — server logs, container logs, load balancer logs, CDN logs23 - **Security tool logs** — WAF, IDS/IPS, endpoint protection, vulnerability scanners24 - **Cloud provider logs** — CloudTrail, Azure Activity Log, GCP Audit Logs, VPC flow logs25 - **Database logs** — query logs, slow query logs, access logs, replication logs26 - **Identity provider logs** — authentication events, token issuance, MFA events27282. **Standardize log format:**29 - Adopt structured logging format (JSON recommended)30 - Define mandatory fields: timestamp (ISO 8601 UTC), service name, environment, log level, correlation ID, user ID (when applicable), source IP31 - Implement correlation IDs across service boundaries for request tracing32 - Sanitize logs to prevent sensitive data in log entries (PII, credentials, tokens)33 - Define log level conventions (ERROR, WARN, INFO, DEBUG) with usage guidelines34353. **Design centralized log aggregation:**36 - Evaluate aggregation platforms (ELK/OpenSearch, Splunk, CloudWatch Logs, Datadog, Sumo Logic)37 - Design collection architecture (agents, sidecars, log forwarding, direct API ingestion)38 - Plan for log volume estimation and capacity planning39 - Implement log parsing and enrichment (geo-IP, threat intelligence lookup)40 - Design search and query capabilities for incident investigation41424. **Define retention policy:**43 - **Security logs** — 1 year minimum (authentication, authorization, access control events)44 - **Audit logs** — 7 years for compliance (SOX, PCI DSS, HIPAA as applicable)45 - **Application logs** — 90 days hot storage, 1 year cold storage46 - **Infrastructure logs** — 30 days hot storage, 6 months cold storage47 - Define storage tiers (hot/warm/cold/archive) with cost optimization48 - Set automated lifecycle policies for tier transitions and deletion49505. **Protect log integrity:**51 - Store logs in immutable storage (write-once, read-many) for audit trail52 - Implement checksums or digital signatures for log entries53 - Restrict access to log data (separate from application access controls)54 - Ensure log deletion requires multi-party approval55 - Design tamper-evident log chains for high-security requirements56576. **Define access control for log data:**58 - Restrict log access by role (security team: full access, developers: own service logs, auditors: read-only)59 - Implement PII masking in log views for non-privileged users60 - Audit log access itself (who searched what, when)61 - Define self-service log access for developers within guardrails62637. **Write the artifact** to `.metapowers/security/$ARGUMENTS/03-detect.md` with heading:6465 ## Logging Architecture6667 Include sections:68 - **Log Sources** — all sources with type, volume estimate, and sensitivity69 - **Log Format Standard** — mandatory fields, correlation ID strategy, and sanitization rules70 - **Aggregation Architecture** — platform selection, collection design, and capacity plan71 - **Retention Policy** — retention periods by log type with storage tier strategy72 - **Log Integrity** — immutability, checksums, and tamper protection measures73 - **Access Control** — role-based log access and PII masking approach7475## Output7677The logging architecture written to `.metapowers/security/$ARGUMENTS/03-detect.md`. Present a summary to the user highlighting:78- Log sources to be aggregated and estimated volume79- Chosen aggregation platform and architecture80- Retention periods by log type and compliance alignment81- Log integrity and access control measures