Log format is consistent across all log sources
Why it matters
NIST AU-3 requires that audit records be formatted consistently so they can be reliably parsed and analyzed. Inconsistent logging — some files using userId, others user_id, some emitting JSON, others emitting plain strings — defeats the purpose of structured logging. A query for userId = 'abc' in your log platform returns no results for log entries that used user_id instead. Inconsistent format also means your log platform's parser may fail to extract structured fields from some entries, causing them to appear as unindexed raw strings. The cost of inconsistency compounds over time: every developer who adds a new log entry makes a slightly different field naming decision, and the drift accelerates.
Severity rationale
Low because log format inconsistency degrades query reliability and incident response efficiency, but does not directly expose vulnerabilities or data.
Remediation
Enforce a single import path for the logger and define standard field names so every log entry in the codebase is consistent.
// Always import from the central module
import logger from '@/lib/logger'
// Standard fields: userId (not user_id), requestId (not req_id), operationId
logger.info({ userId, requestId, operationId: 'checkout.init' }, 'Checkout started')
Do a codebase-wide search for direct console.log and console.error in server-side directories (app/api/, lib/, actions/) and replace with the shared logger:
grep -r 'console\.log\|console\.error' app/api/ lib/
Document your standard field names in lib/logger.ts JSDoc or docs/logging-standards.md so new contributors know the convention. Consider adding an ESLint rule (no-console) for server-side files to prevent regressions.
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 Logging & Monitoring Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- nist:rev5 · AU-3 — Content of Audit Records
- iso-25010:2011 · maintainability
Taxons
History
- 2026-04-18·v1.0.0·Initial import from saas-logging·automated