Skip to content

Enable: repair "do not overwrite" retention to circular (#73) - #80

Merged
spydisec merged 1 commit into
mainfrom
feat/retention-repair-73
Sep 24, 2026
Merged

spydisec merged 1 commit into
mainfrom
feat/retention-repair-73

Conversation

@spydisec

Copy link
Copy Markdown
Owner

Closes #73. From the review of Yamato WELA #379.

Problem: Test fails a kit log whose retention is Do not overwrite events (Retain: logging stops when the log fills), but Enable never changed retention, so the FAIL stayed until someone fixed it by hand.

Change (Enable only)

  • Channel apply: a kit log in Retain mode gets wevtutil sl <log> /rt:false (overwrite as needed, per Microsoft's wevtutil docs), reported as retention "do not overwrite" -> overwrite as needed, with a yellow warning explaining it, that -Rollback restores it, and what to do if it was deliberate. AutoBackup ("archive the log when full") keeps logging, so it's left alone, matching Test (which only fails Retain).
  • Snapshot: Get-CurrentKitState records each log's LogMode.
  • Rollback: restores /rt:true only where the recorded mode was Retain; other modes and older baselines leave retention alone.
  • Existing rollback copies: Add-NewItemsToFirstRun backfills LogMode into pre-Enable: repair "do not overwrite" retention to circular #73 channel entries from the current state (earlier versions never changed retention, so current = pre-kit) and writes the file, without counting it as new settings.
  • Test's FAIL note now says Enable fixes it; Safety (never-do table) and Commands updated.

Checks: Pester 64/64 on PowerShell 7 and 5.1 (2 new: backfill of a pre-#73 baseline; /rt:false only on apply and /rt:true only on rollback). PSScriptAnalyzer clean for the kit; mkdocs build --strict passes.

Not verified here: the apply and rollback of retention need an elevated run on a host with a Retain log; the self-checks cover the logic, not a live change.

🤖 Generated with Claude Code

Test failed a kit log set to Retain ("do not overwrite events"), but
Enable never changed retention, so the FAIL stayed. Enable now runs
wevtutil sl /rt:false on such a log, with a warning, and the state
snapshot records each log's LogMode so -Rollback restores Retain
(/rt:true) where it was the original mode. AutoBackup ("archive when
full") is left alone. Rollback copies from earlier versions get LogMode
backfilled from the current state on the next run (earlier versions
never changed it), without counting as new settings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@spydisec
spydisec merged commit 4cbdcbe into main Sep 24, 2026
4 checks passed
@coderabbitai

coderabbitai Bot commented Sep 24, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 40 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Repository: spydisec/WinLogKit/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 4381597c-4688-4bda-bc81-3f24b6a6d92c

📥 Commits

Reviewing files that changed from the base of the PR and between b0e1257 and db0d84b.

📒 Files selected for processing (6)
  • CHANGELOG.md
  • Enable-LoggingBaseline.ps1
  • Test-LoggingBaseline.ps1
  • docs/commands.md
  • docs/safety.md
  • tests/Kit.Tests.ps1

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@spydisec
spydisec deleted the feat/retention-repair-73 branch September 24, 2026 02:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enable: repair "do not overwrite" retention to circular

1 participant