Security · Logon
4634 · An account was logged off
Event 4634 records that a logon session was terminated and no longer exists, regardless of whether the user or the system ended it. It is mostly used to bound sessions: pair it with the 4624 that shares the same TargetLogonId to measure how long an account was active. On its own it is low priority, but in an investigation it tells you when an attacker's session ended.
Where it is logged
Key fields to read
| Field | What it tells you |
|---|---|
| TargetUserName | Account whose session ended (with TargetDomainName). |
| TargetLogonId | Session ID that matches TargetLogonId in the originating 4624. |
| LogonType | Type of the session that ended (same values as 4624). |
| TargetUserSid | SID of the account, useful when names are reused or renamed. |
Sample event
EventID: 4634
TimeCreated: 2026-03-14T03:02:55.031Z
Computer: NW-FIN-WS07.northwind.local
TargetUserSid: S-1-5-21-3623811015-3361044348-30300820-1188
TargetUserName: m.okafor
TargetDomainName: NORTHWIND
TargetLogonId: 0x3E7A12F
LogonType: 10How to triage it
- 1Find the matching 4624 on the same
Computerwith the sameTargetLogonIdto get the session start, source IP and logon type. - 2Calculate the session duration and compare with what is normal for that logon type (type 3 sessions of seconds are normal; a 45-minute type 10 session at 02:00 is not).
- 3Pull every 4688 (and Sysmon 1) with that logon ID between the 4624 and 4634 to reconstruct what happened inside the session.
- 4Check for a 4647 just before the 4634 to tell a user-initiated logoff from a disconnect or system teardown.
Benign vs suspicious
Usually benign
- High volume of type 3 logoffs from file share and SMB access, which open and close quickly.
- Service and batch sessions ending when tasks or services complete.
- Machine account sessions on servers and domain controllers.
Red flags
- A session that started from a suspicious 4624 (external RDP, after failed logons) and ran for a long time before the 4634.
- Very short interactive or RDP sessions for admin accounts, consistent with scripted hands-on-keyboard activity.
- Many short type 3 sessions for one admin account across many hosts, a lateral movement pattern.
Hunt for it: Splunk & KQL
index=wineventlog (EventCode=4624 OR EventCode=4634) Logon_Type=10
| eval logon_id=coalesce(Logon_ID, TargetLogonId)
| stats min(_time) AS start max(_time) AS end values(src_ip) AS src BY host, user, logon_id
| eval duration_min=round((end-start)/60,1)
| sort - duration_minlet logons = SecurityEvent
| where EventID == 4624 and LogonType == 10
| project LogonTime = TimeGenerated, Computer, TargetUserName, TargetLogonId, IpAddress;
let logoffs = SecurityEvent
| where EventID == 4634
| project LogoffTime = TimeGenerated, Computer, TargetLogonId;
logons
| join kind=leftouter logoffs on Computer, TargetLogonId
| extend DurationMin = datetime_diff("minute", LogoffTime, LogonTime)
| order by DurationMin descField names depend on your add-on and table. More translations in the Splunk vs KQL cheat sheet.
Interview question
“How would you work out how long an attacker was logged on to a server?”
✓ Strong answer sketch
I take the suspicious 4624 and note its TargetLogonId and computer. Then I search the same host's Security log for the 4634 (and any 4647) with the same logon ID, which marks the end of that session. The difference is the session duration, and everything in between, especially 4688 process creations tied to that logon ID, is what the attacker did. If there is no 4634, the session may still be active or the host may have rebooted, which I would confirm before reporting.
Frequently asked questions
What does Event ID 4634 mean?
Event ID 4634 means a logon session was terminated. It does not say who ended it; use the TargetLogonId to match it with the 4624 that started the session.
What is the difference between 4634 and 4647?
4647 is logged when a user actively chooses to log off an interactive or RDP session, while 4634 is logged whenever any session is destroyed, including network logons and sessions ended by the system. A user logoff typically produces a 4647 followed by a 4634.