Structured logging in JSON format is implemented
Why it matters
Unstructured console.log output is unsearchable, unqueryable, and useless when diagnosing production incidents. Without consistent fields — level, timestamp, traceId, userId — correlating a user-reported failure to a server-side log line can take hours. NIST SP 800-53 AU-3 mandates that audit records contain sufficient information to establish what events occurred and who was responsible. ISO 25010 reliability.fault-tolerance requires detectable failure conditions; logs that can't be filtered by severity or correlated by trace ID fail that standard.
Severity rationale
High because unstructured logs make production incident investigation hours slower, directly extending mean time to resolution for every outage.
Remediation
Replace console.log calls with a structured logging library. Pino is the lowest-overhead choice for Node.js; winston is more configurable for multi-transport needs.
// lib/logger.ts
import pino from 'pino'
export const logger = pino({
level: process.env.LOG_LEVEL ?? 'info',
base: { service: 'api' },
})
// Usage:
logger.info(
{ userId: session.userId, traceId: req.headers['x-trace-id'] },
'Payment initiated'
)
Every log call must include at minimum level, timestamp (automatic with pino), and one correlation ID (traceId or requestId). Configure LOG_LEVEL=warn in production to suppress debug noise.
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the Error Resilience Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- iso-25010:2011 · reliability.fault-tolerance
- nist:rev5 · AU-3 — Content of Audit Records
- soc2:2017 · CC7.2 — Monitoring for anomalous system activity
Taxons
History
- 2026-04-18·v1.0.0·Initial import from error-resilience·automated
- 2026-07-06·v1.0.1·Add SOC 2 TSC mapping (CC7.2) from the verified compliance crosswalk register (docs/compliance/).·by soc2-mapping-enrichment-ship-2