Dev.to Security πŸ” Cybersecurity πŸ‘ 0 πŸ“– 6 min read

Event 1102 The Audit Log Was Cleared: A Read-First Subject, Logon ID, and Audit Policy Triage

Security review: "Someone cleared the Security log on a server last night. Is that a problem, or did a script do it?" Good question, and the event answers half of it right away. Event 1102 is Windows recording that the

Security review: "Someone cleared the Security log on a server last night. Is that a problem, or did a script do it?"

Good question, and the event answers half of it right away. Event 1102 is Windows recording that the Security audit log was cleared, and the Subject fields name the account that did it. Microsoft's reference says it "generates every time Windows Security audit log was cleared", and its monitoring advice is blunt: "Typically you should not see this event. There is no need to manually clear the Security event log in most cases. We recommend monitoring this event and investigating why this action was performed."

This post is a read-first order: confirm the event, read who cleared it and from which logon session, check whether someone changed the audit policy around the same time (Event 4719), look at how the log is sized and retained, then decide whether it was routine maintenance or something to escalate. Nothing here changes a server.

TL;DR

  • 1102 is the "log was cleared" event. It is written to the Security log after the clear, so it is the first entry in the fresh log.
  • Read Subject first. Account Name, Account Domain and Logon ID tell you who, and the Logon ID lets you tie it to the 4624 logon that started the session.
  • Check 4719 next. Microsoft says it is "always logged regardless of the Audit Policy Change sub-category setting" and records audit policy changes.
  • A cleared log is a gap, not proof of wrongdoing. Many clears are a tool or a person reacting to a full log. Find out which before you escalate.
  • Back up before you ever clear a log yourself: wevtutil cl has a /bu option that saves the cleared events to an .evtx file.

Step 1: Find the 1102 events (read-only)

Run this in an elevated PowerShell on the server. The event is in the Security log and its provider is Microsoft-Windows-Eventlog.

$ev = Get-WinEvent -FilterHashtable @{ LogName='Security'; Id=1102 } -ErrorAction SilentlyContinue

$ev | ForEach-Object {
    $x = [xml]$_.ToXml()
    $u = $x.Event.UserData.LogFileCleared
    [pscustomobject]@{
        Time    = $_.TimeCreated
        Account = "$($u.SubjectDomainName)\$($u.SubjectUserName)"
        Sid     = $u.SubjectUserSid
        LogonId = $u.SubjectLogonId
        Host    = $_.MachineName
    }
} | Sort-Object Time -Descending | Format-Table -AutoSize

If the result is empty, the log may not have been cleared on this host, or a later clear removed older 1102 entries. Check the next server, and check any central log collector. A collector or SIEM often holds the copy that was forwarded before the clear.

Step 2: Read the Subject fields

The 1102 event uses a UserData block, not the usual EventData block, which is why scripts that look for EventData return nothing. The fields to read, from Microsoft's field descriptions:

Field What it tells you
Security ID SID of the account that cleared the log
Account Name The name of the account that cleared the log
Account Domain Domain or computer name; for a local account this is the computer name
Logon ID A hex value to correlate with events such as 4624 (an account was successfully logged on)

Read the account the way you would for any admin action:

Pattern Likely meaning
A named admin, working hours, change ticket exists Planned maintenance; document it
A service or deployment account A script or tool cleared the log; find the script
A local account name matching the computer name A local account did it; ask why a local account was used
An account that should not have admin rights on this host Escalate and treat as an access problem

Step 3: Tie the Logon ID back to the logon

Take the Logon ID from the 1102 event and look for the 4624 logon that created it. The log was just cleared, so the 4624 may be gone on this host. Look in your forwarded logs first.

$id = '0x55cd1d'   # replace with the Logon ID from the 1102 event
Get-WinEvent -FilterHashtable @{ LogName='Security'; Id=4624; StartTime=(Get-Date).AddDays(-2) } -ErrorAction SilentlyContinue |
  Where-Object { $_.Message -match [regex]::Escape($id) } |
  Select-Object -First 5 TimeCreated, Id, MachineName

On the clearing host the matching 4624 is usually in the log that was cleared, which is exactly why a collector copy matters. If you have one, the logon type and source address on that 4624 tell you whether the session was at the console, over RDP, or over the network.

Step 4: Look for an audit policy change (Event 4719)

A person who wants less evidence may change what is logged as well as clear what was logged. Event 4719 records changes to the system audit policy. Microsoft says this event "is always logged regardless of the 'Audit Policy Change' sub-category setting", and its monitoring recommendation is: "any change in local audit policy should be planned. If this action was not planned, investigate the reason for the change."

Get-WinEvent -FilterHashtable @{ LogName='Security'; Id=4719; StartTime=(Get-Date).AddDays(-7) } -ErrorAction SilentlyContinue |
  Select-Object -First 20 TimeCreated, Id, MachineName

In 4719 the fields to read are the Category, the Subcategory GUID, and the Changes value, which is one or more of "Success removed", "Failure removed", "Success added" and "Failure added". Look up a GUID with:

auditpol /list /subcategory:* /v

A 1102 with no 4719 nearby points to a plain clear. A 1102 followed by a 4719 that removes Success or Failure auditing deserves a closer look.

Step 5: Check the log size and retention

Many clears are not hostile. A full Security log on a busy domain controller is a common reason someone clears it by hand. Read the current settings:

wevtutil gl Security

Look at maxSize and the retention and autoBackup values. Microsoft's wevtutil reference describes the auto-backup policy: if autoBackup is true, "the log will be backed up automatically when it reaches the maximum size", and in that case retention must also be set to true.

If the log keeps filling, the fix is more size, forwarding, or an archive job, not clearing it by hand. Change this in a lab first and through Group Policy where you can, so the setting is consistent across the servers.

Step 6: Decide

What you found What to do
Named admin, ticket, log was full Record it; plan larger size or forwarding
A script or deployment tool did it Fix the script so it exports first, or stop it clearing logs
Unknown or unexpected account Escalate to your security contact; keep the host and your collector copies as they are
1102 plus a 4719 that removed auditing Escalate; restore the audit policy deliberately and document it

If you do need to clear a log yourself, save it first. Microsoft's example is wevtutil cl Application /bu:C:\admin\backups\a10306.evtx, which clears the log and stores the cleared events in the .evtx file you name. Adapt the path, and expect your own 1102 afterwards, which is the correct record of a planned clear.

Common false starts

  • "A 1102 means we were breached." It means the log was cleared. Who, when, and why decide what it means.
  • "Search EventData for the account." 1102 uses UserData, so adjust your filter.
  • "Clear the log to free space." Export it or forward it first.
  • "We have no 1102, so nothing was cleared." Check forwarded copies; the host may not be the one that kept the record.
  • "Ignore 4719." It is the other half of the story and is always logged.

Related posts

Free checklist

Knowing who can change what, and who will notice, is the same habit as planning a new access policy. The free Conditional Access pre-enforcement checklist keeps break-glass accounts, pilot groups, and report-only review on one page:

πŸ‘‰ https://cashflow4375.gumroad.com/l/ujkqxb?utm_source=devto&utm_medium=article&utm_campaign=aps_first_sale&utm_content=event-1102-security-audit-log-cleared

Sources: Microsoft Learn, "1102(S): The audit log was cleared", "4719(S): System audit policy was changed", and the wevtutil command reference. Commands are read-only unless a step says to change something. Test in a lab first.

πŸ“° Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.