Event ID 4634: An account was logged off
Event ID 4634 records that a Windows logon session ended. It shares the TargetLogonId hex value with the 4624 that opened the session, which is the pivot for computing exactly how long that session lasted and for catching sessions that opened but never closed cleanly.
What Triggers Event 4634
Event 4634 is the closing half of a pair. Every interactive, network, service, or remote logon session that Windows opens with a 4624 eventually ends, and when it does, the system logs a 4634 carrying the same TargetLogonId hex value that the 4624 recorded when the session started. That shared LogonId is the single most useful thing about this event: on its own, a 4634 tells you only that some session closed; joined back to its opening 4624, it tells you which account, which LogonType, and exactly how long the session lasted.
TargetUserSid, TargetUserName, and TargetDomainName identify the account whose session ended, mirroring the same fields on the originating 4624. LogonType repeats the enumeration from that same event, 2 for interactive, 3 for network, 10 for RemoteInteractive/RDP, and so on, which matters because "an account logged off" means something very different for a console session than it does for a scheduled-task service logon that opens and closes in milliseconds.
The event fires for a wide range of session endings, not just a user clicking a visible sign-out option. A network share disconnecting, an RPC-authenticated service call completing, an SMB session timing out, an RDP session disconnecting or being forcibly reset, all of these close out with a 4634 tagged to the LogonType that opened them. This breadth is exactly why 4634 alone is a weak signal: it fires constantly, for entirely mundane reasons, dozens or hundreds of times an hour on a busy file server.
What turns 4634 from noise into evidence is arithmetic, not the event itself. Subtracting the 4624 timestamp from the paired 4634 timestamp gives you real session duration, and duration is where the interesting patterns live. A session that opens and closes in under five seconds is not a human interactively working, it is a script, a credential-validation check, or an automated tool authenticating and immediately disconnecting, a shape worth flagging especially when the LogonType is interactive or RemoteInteractive, where a genuine user session almost never closes that fast.
The reverse gap matters just as much. Not every 4624 gets a clean matching 4634. A host that crashes, loses power, or has a logon session forcibly killed by another process leaves the session open from the log's perspective with no closing event ever arriving. That absence is itself diagnostic: a privileged interactive session that opened and never logged a corresponding 4634 within a reasonable window deserves the same scrutiny as an explicit anomaly, because it usually means either an unclean shutdown worth investigating operationally, or a session an attacker deliberately kept alive by killing the logging path rather than logging off normally.
RemoteInteractive sessions deserve their own attention layer beyond individual duration checks. A cluster of RDP logoffs across many distinct accounts within a tight window, particularly outside business hours, reads as a mass disconnect event: a VPN or jump-host outage, a forced logoff pushed by group policy, or, less benignly, an attacker cleaning up multiple sessions across compromised hosts in one coordinated action.
Event 4634 Fields
| Field | What it tells you | Simulated value |
|---|---|---|
TargetUserSid | SID of the account that logged off. | S-1-5-21-424242-367597 |
TargetUserName | Account name that logged off. | svc.inventory |
TargetDomainName | Domain or computer name of the account that logged off. | corp.socsimulator.example |
TargetLogonId | Hex logon session ID being closed; the same value that opened as a 4624 LogonId. | 0x1a9c5e |
LogonType | Logon type of the session being closed (2 interactive, 3 network, 10 RemoteInteractive, etc.), same enum as 4624. | 8 |
Inspect Event 4634 Values
Click a field to inspect the full simulated value, the way you would expand it in a SIEM event view.
Example Event 4634 Log
A representative Security entry for Event 4634, generated deterministically by our telemetry engine so every field holds a realistic, internally consistent value.
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="Microsoft-Windows-Security-Auditing" />
<EventID>4634</EventID>
<Version>0</Version>
<Level>0</Level>
<Task>0</Task>
<Opcode>0</Opcode>
<Keywords>0x8020000000000000</Keywords>
<TimeCreated SystemTime="2025-07-26T03:41:02.000Z" />
<EventRecordID>830061</EventRecordID>
<Channel>Security</Channel>
<Computer>WS-SIM-001.corp.socsimulator.example</Computer>
<Security />
</System>
<EventData>
<Data Name="TargetUserSid">S-1-5-21-424242-367597</Data>
<Data Name="TargetUserName">svc.inventory</Data>
<Data Name="TargetDomainName">corp.socsimulator.example</Data>
<Data Name="TargetLogonId">0x1a9c5e</Data>
<Data Name="LogonType">8</Data>
</EventData>
</Event>Detecting Event 4634
Session duration outlier: 4624/4634 pair shorter than 5 seconds (automated tool, not a human)
Lucene is the base filter; the 4624-to-4634 join and duration math run in your SIEM.
index=wineventlog sourcetype=WinEventLog:Security (EventCode=4624 OR EventCode=4634) | transaction Logon_ID startswith=eval(EventCode=4624) endswith=eval(EventCode=4634) maxspan=1h | eval session_seconds=duration | where session_seconds < 5
Logon session with no matching 4634 within the expected window (killed process, crash, or live-off-the-land persistence)
Lucene is the base filter; the missing-pair detection runs as a left join in your SIEM, over a time range wider than the 1-day grace period, so logons older than that can be checked for a closing 4634.
index=wineventlog sourcetype=WinEventLog:Security EventCode=4624 earliest=-7d latest=-1d | join type=left host, Logon_ID [ search index=wineventlog sourcetype=WinEventLog:Security EventCode=4634 earliest=-7d | stats latest(_time) as logoff_time by host, Logon_ID ] | where isnull(logoff_time) | table _time, host, Account_Name, Logon_ID, Logon_Type
Bulk logoff of RemoteInteractive (LogonType 10) sessions off-hours
index=wineventlog sourcetype=WinEventLog:Security EventCode=4634 Logon_Type=10 | bucket _time span=1h | stats dc(Account_Name) as accounts by _time | where accounts >= 5
True Positive vs False Positive
Most 4634 volume is exactly what it looks like: routine session closure generated by users signing off, scheduled tasks completing, and services cycling their authenticated connections. The baseline for any given host or account is high frequency and largely uninteresting, which is why alerting on 4634 directly is close to useless. Everything that matters here comes from correlation, not from the raw event.
Sub-five-second session durations on interactive or RemoteInteractive logon types are the strongest single tell available from this event. A legitimate interactive user, even one who immediately locks their screen after logging in, takes longer than that between a 4624 and the matching 4634. Automated tooling, credential-validation scripts, and some categories of lateral-movement frameworks authenticate and tear down the session in a fraction of a second, and that gap is measurable precisely because 4634 carries the same LogonId the opening event does.
A missing 4634 is a true positive candidate specifically when the LogonType is privileged or interactive and enough time has passed that a normal session should have closed. Treat this as a two-tier signal: on a workstation, a missing logoff after a crash is common enough to be an IT-hygiene metric rather than a security alert; on a domain controller or another Tier-0 asset, the same pattern, a 4624 with no 4634 within, say, a business day, is unusual enough to warrant checking whether the session is still active and, if so, why.
Bulk RemoteInteractive logoffs are almost always benign when they line up with a known maintenance window, a VPN concentrator restart, or a scheduled group-policy-driven session reset, and the fix here is an allowlist of known maintenance events rather than a fixed numeric threshold. The same pattern outside any documented window, especially spanning accounts that do not normally share a logoff cadence, is worth treating as a possible sign of an attacker closing out sessions across multiple footholds in a short window, either to reduce visible dwell time or as a side effect of a broader disruptive action.
False positives cluster around two causes: legitimate automation, health-check scripts, monitoring agents, and backup jobs that log on and off in seconds as part of normal operation, and environments with aggressive idle-session timeout policies that generate many closely spaced logon and logoff pairs for a single active user bouncing between authentication contexts. Baseline both before tuning a duration threshold, and always pivot to the paired 4624's LogonType and Account fields before deciding whether a short session or a missing logoff is a routine artifact or something that needs a closer look.
Practice Investigating Event 4634
No published room targets Event 4634 directly yet. The detection skills transfer, though: practice alert triage on realistic consoles across 37 free rooms in SOCSimulator Operations.
Browse free operationsFrequently Asked Questions
- What does event ID 4634 mean?
- It means a logon session ended: the account, the LogonId of the session being closed, and the LogonType of that session. It is the closing half of the pair that opened with a 4624 carrying the same LogonId.
- What is the difference between event 4634 and event 4647?
- 4634 is logged by the system whenever any logon session ends, including forced terminations. 4647 is logged only for an explicit, interactive user-initiated logoff (clicking Log off), and never fires for network logons, service logons, or a session ended by the system.
- Why is there no 4634 for every 4624?
- A session can end without a clean logoff record if the host crashes, loses power, or the logon session is killed by another process. Absence of the paired 4634 within the expected window is itself a signal worth alerting on, not just a logging gap.
Sources
“Field schema (TargetUserSid/TargetUserName/TargetDomainName/TargetLogonId/LogonType) and the audit-logoff subcategory definition”
“4647 fires only for an explicit interactive user logoff, the basis for the 4634-vs-4647 distinction”
Related SOC Training Resources
Event ID 4624: Successful Logon, Codes & Queries
Event ID 4624 logs every successful Windows logon. SOCSimulator breaks down the logon type codes, TP/FP triage, and SPL/…
Read more Event IDEvent ID 4625: Failed Logon, Codes & Queries
Event ID 4625 explained: every Status/SubStatus failure code, TP/FP triage logic, and SPL/KQL/Lucene detection queries. …
Read more Event IDEvent ID 4648: Explicit Credentials & How to Detect It
Event ID 4648 logs explicit-credential logons like runas and scheduled tasks. SOCSimulator breaks down the fields and de…
Read more GlossaryWhat is Brute Force Attack? SOC Glossary
A brute force attack systematically tries large numbers of username and password combinations, or decryption keys, until…
Read more GlossaryWhat is Lateral Movement? SOC Glossary
Lateral movement is the attack phase where adversaries expand access from an initial foothold to additional systems, usi…
Read more GlossaryWhat is MFA? SOC Glossary
Multi-Factor Authentication (MFA) requires a user to prove their identity with two or more independent factors, somethin…
Read more GlossaryWhat is SIEM? SOC Glossary
Security Information and Event Management (SIEM) is a platform that aggregates, normalizes, and correlates log data from…
Read more Career PathSOC Analyst (Tier 1) Career Guide: Salary & Skills
Tier 1 SOC Analysts are the front line. You monitor alert queues, triage incoming detections, classify them as true or f…
Read more Career PathSOC Analyst (Tier 2) Career Guide: Salary & Skills
Tier 2 SOC Analysts handle the investigations that Tier 1 escalates. You dig into multi-stage attacks, coordinate contai…
Read more ComparisonSOCSimulator vs. LetsDefend: Platform Comparison
SOCSimulator wins on operational realism. You get multi-tool shift simulation with SLA pressure, noise injection, and al…
Read more Event IDWindows Event ID Library: SOC Reference
Windows Security and Sysmon event IDs with simulated log samples, field tables, and tested detection queries.
Read more FeatureShift Mode: Real-Time SOC Simulation
Practice alert triage under realistic time pressure with SLA timers and noise injection.
Read more