Back

C9: Implement Security Logging and Monitoring - Overview

What is this control?

Security Logging and Monitoring is the proactive control of recording security-relevant events, watching those records in near-real time, and wiring them into detection and response. It is the discipline that lets an organisation know when something is going wrong—and prove afterwards what happened. Logging without monitoring is a write-only archive nobody reads; monitoring without logging has nothing to watch. The control requires both, joined to an incident-response process that can act on what they surface.

This is the defensive counterpart to Security Logging and Monitoring Failures (the OWASP Top 10 category A09). That failure category describes what goes wrong when auditable events are not logged, warnings and errors generate no or inadequate log messages, logs are not monitored for suspicious activity, logs are stored only locally, alerting thresholds are missing, and penetration tests or scans do not trigger alerts. This control is the set of practices that close every one of those gaps.

Core Concept

Blind system (failure mode):
  Events        -> only crashes are logged; auth, access, admin actions are not
  Context       -> "error occurred" with no who / what / when / where
  Format        -> free-text strings, each service different, unparseable
  Storage       -> local disk on each host, rotated away in days
  Monitoring    -> nobody looks; logs read only after a breach is announced
  Alerting      -> none, or so noisy every alert is ignored
  Response      -> discovered by a third party months later

Instrumented system (control applied):
  Events        -> auth, access-control, validation, admin, high-value txns logged
  Context       -> who, what, when, where, plus a correlation / trace ID
  Format        -> consistent, machine-parseable structured records (e.g. JSON)
  Storage       -> centralized, append-only, integrity-protected, retained
  Monitoring    -> SIEM correlates events against a known-normal baseline
  Alerting      -> tuned, actionable alerts routed to responders
  Response      -> detection triggers a rehearsed incident-response playbook

The three obligations

The control is often summarised as three linked obligations, none of which stands alone:

Why This Control Matters

Business Impact of Getting It Right

Technical Impact of Getting It Wrong

What to Log and With What Context

Security-relevant events to capture

Log the events that let you detect abuse and reconstruct an incident. At minimum:

Event classExamplesWhy it matters
AuthenticationLogin success and failure, logout, MFA challenge/failure, password reset, token issue/refreshDetect brute force, credential stuffing, account takeover
Access-control failuresDenied authorization, attempts to reach another user's object, forbidden admin routesDetect enumeration and privilege abuse (IDOR/BOLA probing)
Input-validation failuresRejected input, schema violations, WAF blocks, injection-pattern hitsDetect active exploitation attempts and scanning
High-value transactionsPayments, transfers, order placement, data exports/downloadsDetect fraud and bulk exfiltration
Administrative actionsRole/permission changes, user creation/deletion, config changes, feature-flag flipsDetect insider abuse and post-compromise persistence
Permission & identity changesGrants, revocations, group membership, key/credential rotationDetect privilege escalation and backdoor accounts

Sufficient context: who, what, when, where

An event is only useful if it answers the investigator's questions. Every security log entry should carry:

Structured, machine-parseable format

Free-text log lines that differ between services cannot be searched, correlated, or alerted on reliably. Emit structured records—typically JSON—with a consistent schema and stable field names, so a SIEM can index and query them:

{
  "timestamp": "2026-08-29T14:03:11.482Z",
  "event": "authn.login.failure",
  "outcome": "failure",
  "actor": { "user_id": "u_8842", "src_ip": "203.0.113.44", "ua": "curl/8.4" },
  "target": { "resource": "/api/session", "method": "POST" },
  "reason": "invalid_password",
  "trace_id": "b7f1c2a9-3e5d-4a11-9c2e-77a0d1e4f8bd",
  "service": "auth-api",
  "env": "prod"
}

The field names matter less than their consistency. Pick a schema, document it, and make every service emit the same shape so correlation is a query, not a research project.

From Event to Response: The Pipeline

The control is a pipeline, and it is only as strong as its weakest stage:

1. Instrument   -> emit structured security events with full context + trace ID
        ↓
2. Ship         -> forward off-host in near-real time (never trust local disk alone)
        ↓
3. Centralize   -> SIEM / log platform ingests, normalizes, and correlates
        ↓
4. Baseline     -> learn normal behavior; flag statistically anomalous activity
        ↓
5. Alert        -> tuned thresholds fire actionable, deduplicated alerts
        ↓
6. Respond      -> alert triggers a tested incident-response playbook
        ↓
7. Test         -> verify (red team / pentest) that detection actually fires

Supporting requirements that make the pipeline trustworthy

Two things you must NOT do

Real-World Incident Classes

Rather than cite specific breach figures, the durable, defensible pattern across public post-mortems is that detection failures extend dwell time—attackers operate for weeks or months because the events that would have exposed them were never logged, never monitored, or never alerted on.

Class 1: Long-dwell breaches discovered by outsiders

A recurring pattern in major breaches is that the victim learns of the compromise from a third party (a bank, a researcher, law enforcement) rather than from their own monitoring. The technical root cause is consistent: the security-relevant events existed but were not logged, centralised, or alerted on, so the intrusion ran undetected for a long dwell time.

Class 2: Credential stuffing and brute force at scale

Automated login attacks succeed quietly when authentication failures are not logged and rate-anomalies are not alerted. With structured authn logs and a baseline, a spike of failures from many IPs against many accounts is an obvious, catchable signal; without them it is invisible until fraud appears downstream.

Class 3: Enumeration and access-control probing (IDOR/BOLA)

Attackers walk sequential IDs or fuzz authorization boundaries. If access-control failures are logged with actor and target, a single actor generating hundreds of "forbidden" outcomes across many objects is a clear detection; unlogged, the enumeration completes silently.

Class 4: Insider and post-compromise privilege abuse

Role changes, new admin accounts, and mass data exports are the fingerprints of both malicious insiders and attackers establishing persistence. Logging administrative actions and permission changes—and alerting on the anomalous ones—is frequently the only control that surfaces this behaviour.

Class 5: Bulk data exfiltration

Large exports and downloads that dwarf normal usage are detectable only if high-value transactions are logged and baselined for volume. Absent that, terabytes can leave before anyone notices.

Common Misunderstandings

Myth 1: "We log everything, so we're covered"

Reality: Volume is not detection. If nobody monitors the logs, if they are unstructured, or if alerting is untuned, logging "everything" just produces an expensive archive and crushing alert fatigue. Log the right events, and monitor them.

Myth 2: "Application logs are the same as security logs"

Reality: Debug and performance logs rarely capture authentication, access-control, and admin events with the actor/target/outcome context an investigation needs. Security events must be deliberately instrumented.

Myth 3: "Logs on the server are good enough"

Reality: Local-only logs are exactly what an attacker deletes after landing on the host, and they cannot be correlated across services. Ship logs off-host to a centralised, append-only store in near-real time.

Myth 4: "More alerts mean more security"

Reality: Untuned alerting is the primary cause of missed detections—responders learn to ignore a channel that cries wolf. Fewer, higher-fidelity, actionable alerts beat a firehose.

Myth 5: "It's fine to log the request as-is"

Reality: Logging raw requests captures passwords, tokens, and PII, and lets an attacker inject forged log lines or downstream payloads. Redact sensitive fields and neutralise untrusted data before it is written.

Myth 6: "We have a SIEM, so detection works"

Reality: A SIEM that no red-team exercise or pentest ever manages to trigger is unproven. Test detection deliberately; an untested alerting rule is an assumption, not a control.

How This Control Relates to A09

AspectThe Failure (A09)The Control (C9)
Auditable eventsNot logged, or logged without contextSecurity events logged with who/what/when/where + trace ID
FormatInconsistent free text, unparseableConsistent, machine-parseable structured records
StorageLocal only, mutable, short retentionCentralized, append-only, integrity-protected, retained
MonitoringNobody watches; no baselineSIEM correlation against a known-normal baseline
AlertingMissing thresholds or alert fatigueTuned, actionable, real-time alerts
ResponseDetected late, by a third partyDetection feeds a tested incident-response playbook

Key Takeaways

  1. Log, monitor, respond—all three: any one alone fails. Records nobody reads, or monitoring with nothing to read, both leave you blind.
  2. Context is what makes a log useful: who, what, when, where, and a correlation ID turn an entry into evidence.
  3. Structure enables detection: consistent, machine-parseable records are the precondition for correlation and alerting.
  4. Centralize, protect, and time-sync: append-only off-host storage on synchronised clocks is what survives an attacker and holds up in an investigation.
  5. Tune alerts and test detection: fight alert fatigue with actionable alerts, and prove the pipeline fires by making pentests trip it.
  6. Never leak through your logs: redact secrets and PII, and neutralise untrusted data to prevent log injection.

Next Steps