Skip to content
high severityMicrosoft Defender XDR

Detect Windows event log clearing (KQL)

Clearing event logs is a deliberate anti-forensic act: it removes the on-host record of what an attacker did. This DeviceProcessEvents query matches wevtutil cl (clear-log) and the PowerShell Clear-EventLog / Remove-EventLog cmdlets, so you can catch log tampering as it happens.

Treat any hit as suspicious — routine administration very rarely clears logs, and when it does it should be change-managed and attributable.

The query

DeviceProcessEvents
| where Timestamp > ago(7d)
| where (FileName =~ "wevtutil.exe" and ProcessCommandLine has_any ("cl ", "clear-log"))
    or (FileName in~ ("powershell.exe", "pwsh.exe")
        and ProcessCommandLine has_any ("Clear-EventLog", "Remove-EventLog", ".ClearEventLog"))
| project Timestamp, DeviceName, AccountName,
          InitiatingProcessFileName, InitiatingProcessCommandLine, ProcessCommandLine
| sort by Timestamp desc

Line-by-line explanation

  • FileName =~ "wevtutil.exe" and ProcessCommandLine has_any ("cl ", "clear-log")

    wevtutil cl (or clear-log) clears a specified event log; the trailing space in "cl " avoids matching unrelated words.

  • ProcessCommandLine has_any ("Clear-EventLog", "Remove-EventLog", ".ClearEventLog")

    Covers the PowerShell cmdlets and the .NET EventLog.Clear method used to wipe logs from a script.

  • project ... ProcessCommandLine

    Keeps the command line so you can see which log was targeted (for example Security or System).

Required tables and columns

  • FileNameThe binary clearing logs (wevtutil.exe or a PowerShell host).
  • ProcessCommandLineCommand line naming the log being cleared.
  • InitiatingProcessFileNameThe parent process requesting the clear.
  • AccountNameAccount performing the action.

MITRE ATT&CK mapping

Tuning and false positives

  • Correlate with the Security log's own 1102 (audit log cleared) and System 104 events for independent confirmation.
  • Exclude only vetted log-rotation tooling, scoped by host and exact command.

Limitations

  • Selective tampering (deleting individual records or stopping the Event Log service) is not covered; this targets wholesale clears.
  • An attacker who disables logging before acting leaves nothing for this to catch.

References

Last reviewed 2026-11-18.