Skip to content
SIEMBench
100% Client-Side Tool • Inputs Never Sent to Our Servers

Event ID 4647

Event ID 4647: User-Initiated Logoff

User initiated logoff

Log source
Security
How to enable it
Logon/Logoff > Audit Logoff (Success)
Category
Authentication
Priority
Low
Typical volume
Medium
MITRE ATT&CK

What Event ID 4647 means

4647 is logged when a user begins to sign out of an interactive or Remote Desktop session. Unlike 4634, which records the technical end of any session, it reflects a decision by whoever controlled the desktop.

That makes it good evidence of presence. If an administrator says that they were asleep at 03:00 and the server shows a type 10 logon followed forty minutes later by 4647, somebody sat at that session, worked and left it tidily. Intruders who disconnect without signing out leave 4779 and a lingering session instead.

The event carries no logon type and no address. Both have to be fetched from the 4624 that shares the same TargetLogonId, which is why the two should always be collected together.

Key fields to inspect

FieldMeaningSuspicious when
TargetUserName Account that signed out. A service account, which should never have an interactive desktop.
TargetDomainName Domain or computer of the account. The computer's own name on a server where local accounts are not used.
TargetLogonId Session identifier shared with the 4624. A session that began from an unfamiliar address.
TargetUserSid Security identifier of the account. A SID that no longer resolves, because the account was deleted afterwards.

Detection queries

List interactive sessions on servers that ended outside working hours, with the address they came from. Adjust names and thresholds to your environment. About these queries.

Splunk SPL

index=windows source="XmlWinEventLog:Security" (EventCode=4647 OR (EventCode=4624 AND (LogonType=10 OR LogonType=2)))
| stats earliest(_time) AS start latest(_time) AS end values(IpAddress) AS src dc(EventCode) AS parts BY Computer TargetLogonId TargetUserName
| where parts=2
| eval hour=tonumber(strftime(end, "%H")), minutes=round((end-start)/60)
| where hour<6 OR hour>=22

Microsoft Sentinel KQL

let opened = SecurityEvent
| where EventID == 4624 and LogonType in (2, 10)
| project Computer, TargetLogonId, IpAddress, Start = TimeGenerated;
SecurityEvent
| where EventID == 4647
| project Computer, TargetLogonId, TargetUserName, End = TimeGenerated
| join kind=inner opened on Computer, TargetLogonId
| extend Minutes = datetime_diff("minute", End, Start)
| where hourofday(End) < 6 or hourofday(End) >= 22
| project End, Computer, TargetUserName, IpAddress, Minutes

PowerShell

Get-WinEvent -FilterHashtable @{ LogName = 'Security'; Id = 4647; StartTime = (Get-Date).AddDays(-7) } |
  ForEach-Object { $d = @{ Time = $_.TimeCreated }; ([xml]$_.ToXml()).Event.EventData.Data | ForEach-Object { $d[$_.Name] = $_.'#text' }; [pscustomobject]$d } |
  Select-Object Time, TargetUserName, TargetDomainName, TargetLogonId | Format-Table -AutoSize

Attack scenarios

Hands-on-keyboard intrusion over Remote Desktop

Operators who log in to a server interactively often sign out properly to avoid leaving a disconnected session for the owner to notice. A pair of 4624 type 10 and 4647 at night brackets the period to examine.

Account sharing

Two people who use one privileged account produce overlapping sessions from different addresses, each with its own sign-out. The pattern breaks attribution and is usually against policy.

Investigation checklist

  1. Find the 4624 with the same TargetLogonId and record its LogonType and IpAddress.
  2. Review processes started during the session in 4688 or Sysmon event 1.
  3. Ask the account owner about the session before telling them what you found.
  4. Check for other sessions by the same account on neighboring servers.

Common benign causes

Event ID 4647 FAQ

Does closing a Remote Desktop window create 4647?

No. Closing the window disconnects the session and leaves it running, which is recorded as 4779. The event appears only when the user signs out or a sign-out is started for them.

Does shutting down a computer log 4647?

Usually yes for users who are signed in, because shutdown starts a sign-out. A forced power-off or crash does not produce it.

Why does 4647 not show an IP address?

It describes the end of a session and not its origin. Look up the 4624 with the same TargetLogonId on that computer to get the address and logon type.

Techniques follow MITRE ATT&CK® v20.1. © 2026 The MITRE Corporation. This work is reproduced and distributed with the permission of The MITRE Corporation (license). Field names were checked against Microsoft documentation and provider schemas.