Most applications log security events, but each team names them differently, so the SOC cannot write one rule that finds credential stuffing or token replay across the estate. A shared vocabulary of application security events fixes that: when every service emits authn_login_fail, authz_fail or authn_token_reuse with the same fields, detection engineers can alert on the event name rather than reverse-engineering every log format. This guide explains the OWASP Application Logging Vocabulary, how to turn it into an organisational event schema, how to map it to a common SIEM schema, which detections it enables, and how to roll it out without drowning the SOC in noise. It is written for AppSec engineers, platform teams that own logging libraries, and detection engineers. For error handling and what never to log, see the Secure Error Handling and Logging Guide; this page goes deeper on naming, schema and detection.
Key takeaways
- Name the event, not the symptom. A stable event name such as
authn_login_faillets one detection cover every application; free-text messages such as "bad password for user" do not. - Start from the OWASP vocabulary. The OWASP Application Logging Vocabulary Cheat Sheet defines prefixed event types (AUTHN, AUTHZ, SESSION, EXCESS, INPUT, MALICIOUS, PRIVILEGE, USER, SYS, MCP and others) with suggested levels and fields.
- Agree the envelope as well as the names. A fixed JSON envelope with ISO 8601 timestamps carrying a UTC offset, application ID, request ID and outcome is what makes events correlatable (ASVS V16.2.1 to V16.2.4).
- Machine identities need events too. Token creation, revocation and reuse (
authn_token_created,authn_token_revoked,authn_token_reuse) are the application-side trail for API keys and service tokens. - Ship it as a library. Vocabulary adoption succeeds when the platform team publishes a small security logging library per language and a test that fails the build when a required event is missing.
Why application security events need a vocabulary
Infrastructure logs have shared identifiers: Windows has event IDs, cloud audit logs have API action names. Application logs usually have neither. The OWASP Logging Cheat Sheet asks for logging that is consistent within an application and across an organisation's portfolio, using industry standards where they exist, so events can be consumed, correlated and analysed by many systems. The Logging Vocabulary Cheat Sheet then proposes concrete keywords, so that "monitoring and alerting would be improved by simply keying on these terms".
Three things go wrong without one:
- Detections do not transfer: a credential stuffing rule written for one service's message format misses the next service.
- Severity is invented per team: one service logs authorisation failures at DEBUG, another at ERROR, and the SOC tunes both away.
- Coverage cannot be measured: nobody can answer "which applications log token reuse?" because there is nothing consistent to count.
OWASP ASVS 5.0 makes this auditable. V16.1.1 asks for an inventory of what is logged at each layer, V16.3.1 for logging of all authentication operations, V16.3.2 for failed authorisation attempts, and V16.3.3 for the security events defined in the application's documentation plus attempts to bypass controls such as input validation, business logic and anti-automation. A vocabulary is the documentation those requirements refer to.
The OWASP Application Logging Vocabulary
Each event type has a lowercase prefix, a name and optional bracketed context, for example authn_login_fail_max[:userid,maxlimit]. The cheat sheet marks every field after the event type as optional and asks implementers to weigh detection value against their data protection duties: an IP address helps response but can be personal data. The table lists the event types that carry most detection value, with the level the cheat sheet suggests.
| Category | Event | Suggested level | What it signals |
|---|---|---|---|
| AUTHN | authn_login_success, authn_login_fail | INFO, WARN | Every login attempt, the raw material for brute force and spraying detection |
| AUTHN | authn_login_successafterfail | INFO | Success after failures: a successful guess or a forgetful user |
| AUTHN | authn_login_fail_max, authn_login_lock | WARN | Thresholds reached; lockout applied |
| AUTHN | authn_password_change_fail | CRITICAL | Failed password change, possible session takeover in progress |
| AUTHN | authn_impossible_travel | CRITICAL | Same user from distant regions in an impossible time |
| AUTHN | authn_token_created, authn_token_revoked, authn_token_delete | INFO, INFO, WARN | Lifecycle of service tokens and API keys, with entitlements |
| AUTHN | authn_token_reuse | CRITICAL | A revoked token presented again: a strong indicator of theft |
| AUTHZ | authz_fail | CRITICAL | Access to a resource the caller is not entitled to |
| AUTHZ | authz_change, authz_admin | WARN | Entitlement changes and all privileged user activity |
| SESSION | session_use_after_expire | CRITICAL | Expired session presented, possible replay |
| EXCESS | excess_rate_limit_exceeded, excess_sessions_exceeded | WARN | Automation and abuse against limits |
| INPUT | input_validation_fail, input_validation_discrete_fail | WARN | Server-side validation rejected input; a discrete list value was violated |
| MALICIOUS | malicious_direct_reference, malicious_sqli, malicious_attack_tool, malicious_extraneous | CRITICAL | Attempts the application recognised and blocked |
| SEQUENCE | sequence_fail | CRITICAL | A business flow reached out of order |
| PRIVILEGE, USER | privilege_permissions_changed, user_created, user_deleted | WARN | Escalation and account lifecycle changes |
| SYS | sys_monitor_disabled | WARN | An integrity, logging or antivirus agent was stopped, and by whom |
| MCP | mcp_prompt_injection, mcp_tool_poisoning, mcp_resource_exhaustion | WARN | Indicators detected by an MCP client or server |
Treat the suggested levels as a starting point. The Logging Cheat Sheet warns that input validation failures are suspicious, not proof of attack, because client defects also produce them, and that severity should be judged by repetition, correlation and context. For the MCP events, the vocabulary advises logging a detection category or rule ID and request identifiers rather than the full prompt or tool input and output, to avoid creating a second sensitive data store and a log injection path.
Designing the event envelope
Names alone are not enough; every event needs the same envelope. The OWASP vocabulary's example format carries datetime (ISO 8601 with UTC offset), appid, event, level, description, useragent, source_ip, host_ip, hostname, protocol, port, request_uri, request_method, region and geo. The Logging Cheat Sheet adds an interaction identifier linking all events for one request, a user type classification (authenticated user, monitoring system, authorised penetration tester) and analytical confidence.
- Structured, not text: emit JSON. The Logging Cheat Sheet recommends structured formats specifically because unstructured text logs are open to CR/LF log entry injection (CWE-93), and ASVS V16.4.1 requires encoding to prevent log injection.
- Separate fields for context: keep the vocabulary's bracketed context (
userid,resource,tokenid) in named fields as well as in the event string, so the SIEM does not have to parseauthn_login_fail:joebob1. - Explicit outcome: add an
outcomefield (success, failure, unknown) even where the name implies it, to support schema mapping. - Actor type: record whether the actor is a human user, a service account, an API client or an AI agent. This is what lets the SOC treat a burst of
authz_failfrom a workload identity differently from a user's. - Time: synchronised clocks and UTC or explicit offsets (ASVS V16.2.2).
- Never in the envelope: passwords, access tokens, session IDs (hash them if you need correlation), connection strings, keys and payment data. The Logging Cheat Sheet's "Data to exclude" list is the baseline. See the JWT and Session Tokens in Code and Logs Guide.
Mapping the vocabulary to a SIEM schema
Most SIEMs normalise to a schema of their own. Keep the OWASP name in a dedicated field (for example event.action) and map the rest, so analysts can use both the portable vocabulary and the platform's built-in content. The Elastic Common Schema (ECS) is used here as an example because its allowed values are published openly: event.category includes authentication, iam, session, intrusion_detection and web, and event.outcome takes success, failure or unknown.
| OWASP event | Example ECS mapping | Notes |
|---|---|---|
authn_login_fail | event.category: authentication, event.type: start, event.outcome: failure | Keep the vocabulary name in event.action |
authn_token_created | event.category: iam, event.type: creation | Record entitlements and the owning identity |
authz_fail | event.category: web or api, event.outcome: failure | Include the resource and the policy that denied |
session_expired | event.category: session, event.type: end | Reason field distinguishes idle and absolute timeout |
malicious_sqli | event.category: intrusion_detection, event.type: denied | Include the rule ID, not the payload |
user_created, authz_change | event.category: iam, event.type: user or change | Actor and target user both required |
The same approach works for other schemas: map once in the logging library or the ingest pipeline, test the mapping, and publish it so detection engineers know which fields to query.
Detections the vocabulary enables
With consistent names, a small set of rules covers every application. Typical starting rules:
- Password spraying (T1110.003):
authn_login_failacross many distinct user IDs from one source in a short window. - Credential stuffing (T1110.004): high
authn_login_failvolume with a low but non-zeroauthn_login_successrate from rotating sources, followed byauthn_login_successafterfail. - Stolen token use (T1550.001): any
authn_token_reuse, or a token used from a new network shortly afterauthn_token_created. - Valid account abuse (T1078):
authn_impossible_travel, or a login success followed by a run ofauthz_failas the caller probes what it can reach. - Object-level enumeration: repeated
malicious_direct_referenceorauthz_failon sequential resources from one identity, the application view of API1:2023 BOLA probing. - Defence tampering (T1685):
sys_monitor_disabledoutside a change window. - Business logic abuse:
sequence_failclustered on one account or flow, which no network control can see.
Feed CRITICAL-level events from the vocabulary to the SOC queue directly; aggregate WARN-level events and alert on thresholds. For broader API abuse patterns, see the Rate Limiting and API Abuse Guide.
Where identity fits: events for service accounts, tokens and agents
Application logs are often the only place where API key and service token activity is visible at all, because the token is validated in the application, not by the identity provider. Apply the AUTHN token events to every non-human credential the application issues or accepts: who created the key, with which entitlements, when it was revoked, and every presentation of a revoked or expired one. Record authz_fail for service callers with the client ID, so a workload that suddenly probes outside its normal endpoints stands out. For applications that expose tools to AI agents, add the MCP events and record the agent's identity separately from the human it acts for. See the Detection Engineering for Non-Human Identities Guide.
Choosing where events are generated
Not every security event has to come from application code. The decision is about who has the context to know an event happened.
| Source | Good for | Blind to | Use when |
|---|---|---|---|
| Application code (vocabulary library) | Authorisation decisions, business sequence, token lifecycle, discrete validation failures | Nothing it is not coded for | Always for AUTHZ, SEQUENCE and token events, which only the application understands |
| Identity provider | Interactive logins, MFA, federation | Application-issued API keys, object-level access | Login events where the application delegates authentication entirely |
| API gateway or WAF | Rate limits, schema validation, known attack signatures | Whether the caller owned the object; business flow order | EXCESS and MALICIOUS events at the edge, emitted with the same names |
| Runtime agent or framework middleware | Consistent coverage without code changes | Domain meaning of resources | Large legacy estates as a first step before library adoption |
Where the identity provider owns login, do not duplicate authn_login_* events in the application; correlate on the session or token instead. Where the gateway rejects a request, it should emit the vocabulary event so the SOC sees one naming scheme regardless of which layer acted. The rule of thumb: the layer that makes the decision logs the decision.
Rolling out a security event vocabulary
- Publish the organisational vocabulary: adopt the OWASP event names as-is, add only the house events you genuinely need (with the same naming pattern), and define the envelope, levels and required fields in one versioned document.
- Build the libraries: a thin wrapper per language (the cheat sheet lists community libraries for Python, .NET, Java, Go and Node.js that can be evaluated or used as a pattern) with one function per event, so developers cannot misspell names or forget fields.
- Pilot on authentication: instrument the login, token and session events in one or two high-value applications first; map them in the SIEM and build the spraying, stuffing and token reuse rules.
- Run detections in monitor mode: two to four weeks of tuning before paging anyone; record false positive causes (load tests, monitoring probes, pen tests) and tag those actors rather than dropping their events, as the Logging Cheat Sheet advises.
- Extend by risk: authorisation and privilege events next, then input and malicious events, then business sequence events for fraud-relevant flows.
- Make it testable: unit tests assert that a failed login emits
authn_login_failwith required fields; an ingest test fails when an application stops sending an expected event type.
Rollback: event emission should never break the request path. Log asynchronously, fail open on the logger (but alert on logger failure through sys_ events or pipeline health), and keep a feature flag to reduce verbose event classes if volume spikes.
Small versus large organisations: a small team can adopt the vocabulary directly in its logging configuration and start with five detections. A large estate needs the libraries, a schema registry, ownership of the SIEM mapping, and a coverage dashboard per application.
Detection and measurement
- Coverage: percentage of internet-facing applications emitting the core AUTHN and AUTHZ events with all required fields.
- Schema conformance: share of security events that pass schema validation at ingest (target above 99%).
- Token visibility: percentage of applications that issue or accept API keys and emit
authn_token_createdandauthn_token_revoked. - Detection value: alerts per month from vocabulary-based rules, with true positive rate after tuning.
- Silence detection: number of applications whose expected event volume dropped to zero, and time to notice.
- Hygiene: secret or token findings in application logs from periodic scanning (target zero).
Framework mapping
| Framework | Reference | Relevance |
|---|---|---|
| OWASP ASVS 5.0 | V16.1.1, V16.2.1 to V16.2.5, V16.3.1 to V16.3.4, V16.4.1 to V16.4.3 | Log inventory, metadata, common format, required security events, injection and protection |
| NIST CSF 2.0 | PR.PS-04, DE.CM-09, DE.AE-02, DE.AE-03 | Logs generated for monitoring; application monitoring; analysis and correlation |
| NIST SP 800-53 Rev. 5 | AU-2, AU-3, AU-8, AU-9, AU-12, SI-4 | Event logging, record content, time stamps, protection, generation, monitoring |
| ISO/IEC 27001:2022 Annex A | A.8.15, A.8.16 | Logging; monitoring activities |
| MITRE ATT&CK | T1110.003, T1110.004, T1078, T1550.001, T1685 | Techniques the vocabulary-based detections target |
Common failure patterns
- Vocabulary in name only: teams adopt the names but put the context in free text, so the SIEM still parses strings. Require named fields.
- Logging the secret to explain the failure:
authn_token_reuseevents that include the full token value. Log the token ID or a hash. - Everything CRITICAL: every input validation failure pages the SOC, which then mutes the feed. Aggregate WARN events.
- Dropping "known" traffic: filtering out monitoring and pen test sources at the application hides real attacks from those addresses. Tag them instead.
- Logs stay with the application: events written to local files that an attacker who compromises the host can edit. ASVS V16.4.3 requires shipping to a logically separate system.
- No negative test: a refactor removes the login failure event and nobody notices for months, because nothing alerts on silence.
Practitioner checklist
- Publish an organisational security event vocabulary based on the OWASP Application Logging Vocabulary, versioned and owned.
- Define one JSON envelope with ISO 8601 UTC timestamps, application ID, request ID, actor type and outcome.
- Ship a security logging library per language; forbid hand-written security event strings.
- Instrument AUTHN, AUTHZ and SESSION events first, including token create, revoke and reuse for API keys and service tokens.
- Map events to the SIEM schema in one place and keep the vocabulary name in its own field.
- Deploy spraying, stuffing, token reuse, BOLA probing and monitor-disabled detections in monitor mode, then enforce.
- Exclude passwords, tokens, session IDs, keys and payment data; scan logs for secrets.
- Ship logs off-host to a protected store and alert on missing event streams.
- Add unit tests that assert required events and fields on security-relevant code paths.
Standards and references
- OWASP Cheat Sheet Series: Application Logging Vocabulary Cheat Sheet
- OWASP Cheat Sheet Series: Logging Cheat Sheet
- OWASP: Application Security Verification Standard 5.0
- NIST: SP 800-92 Guide to Computer Security Log Management
- NIST: SP 800-53 Rev. 5
- Elastic: ECS event.category allowed values
- MITRE ATT&CK: Brute Force
Related NHI Mgmt Group resources: Secure Error Handling and Logging Guide · Privacy in Security Logging and Monitoring Guide · Logging and Monitoring Policy Template · OMB M-21-31 Logging Maturity Guide