Skip to content

fix(logs): read the kind of a timeline from a rolled log file - #35

Merged
fadwen merged 1 commit into
mainfrom
fix/timeline-rolled-log
Oct 10, 2026
Merged

fadwen merged 1 commit into
mainfrom
fix/timeline-rolled-log

Conversation

@fadwen

@fadwen fadwen commented Oct 10, 2026

Copy link
Copy Markdown
Owner

Summary

Get-IntuneAgentTimeline reported Kind as Unknown for a policy or app whose lines all sat in a rolled log file. The agent rolls HealthScripts.log over to HealthScripts-20260925-101500.log; the kind lookup stripped one -digits suffix from the log name, which removed the time and left HealthScripts-20260925, a name the log table does not have. Reproduced on the lab device's own rolled HealthScripts-20261008-202550.log: three remediations with 46 to 92 runs each came back Unknown.

Two documentation items found at the same time: the parser's comments quoted a 22 MB log where the 0.28.0 changelog measured 15 MB for the same 80,000 entries, and the README's log blocks predated the Agent abbreviation in the Log column and the list form of the diagnostic result.

Changes

  • Public/Get-IntuneAgentTimeline.ps1: the rolled suffix is matched as -\d{8}-\d{6}$, so both the date and the time come off before the name is looked up.
  • Tests/Unit/Public/Get-IntuneAgentTimeline.Tests.ps1: a remediation whose two lines sit in HealthScripts-20260925-101500.log alone reads as Remediation, keeps the rolled name on its steps, and carries its outcome.
  • Private/ConvertFrom-IslCmTraceLog.ps1: the two comments carry the changelog's figures (15 MB, 80,000 entries, 5 s for one policy against 30 s for every entry).
  • README.md: the Enrollment Status Page block shows Agent in the Log column and its command selects the four columns the block shows; the diagnostic block shows the list the command prints since 0.28.0, with the figures from a run on the lab device today.
  • CHANGELOG.md: Fixed entries under Unreleased.

Verification

  • Get-IntuneAgentTimeline, Get-IntuneAgentLog, ConvertFrom-IslCmTraceLog and Module.Contract suites: 55 passed on PowerShell 7.6.6; the first three under Windows PowerShell 5.1: 39 passed.
  • On the lab device (ISLISLESP01, 0.31.0 from the Gallery) a timeline over its rolled HealthScripts-20261008-202550.log alone read Unknown for all three remediations; the new test encodes the same shape and passes with the fix.
  • PSScriptAnalyzer (Error, Warning) clean on the two changed source files; no line over 115 characters.

Get-IntuneAgentTimeline reported Kind as Unknown for a policy or app whose
lines all sat in a rolled log file. The agent rolls HealthScripts.log over
to HealthScripts-20260925-101500.log, and the kind lookup stripped one
-digits suffix from the log name, which removed the time and left a name
the log table does not have. Both parts come off now. Reproduced on the
lab device: three remediations read from its rolled HealthScripts log
alone all came back Unknown.

The parser comments quoted a 22 MB log where the 0.28.0 changelog measured
15 MB for the same 80,000 entries; they carry the measured figures. The
README log blocks show the Agent abbreviation in the Log column and the
list form of the diagnostic result, as the commands print them.

@fadwen fadwen left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Notes on the lines whose reason the diff does not show.

$logsSeen = @($steps | ForEach-Object { $_.Log -replace '-\d+$', '' } | Sort-Object -Unique)
# A rolled file is HealthScripts-20260925-101500: both date and time come off, or the name
# never matches the table and a policy whose lines all sit in a rolled file reads as Unknown
$logsSeen = @($steps | ForEach-Object { $_.Log -replace '-\d{8}-\d{6}$', '' } | Sort-Object -Unique)

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anchored to the exact rolled shape (eight digits, dash, six digits) rather than a looser repeat of -digits, so a hypothetical log whose base name ends in a number is not shortened by accident. The agent has produced only this shape on the lab devices across all rounds.

# whose lines all sit in the rolled file is still a remediation
$rolled = Join-Path $TestDrive 'Rolled'
$hs = @{ Component = 'HealthScripts' }
Write-TestLog $rolled 'HealthScripts-20260925-101500.log' @(

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A separate folder with the rolled file alone, rather than adding a rolled file next to the fixture's current logs: with both present the current file would supply the kind and the test would pass without the fix.

$ordinal = [System.StringComparison]::Ordinal

# An agent log of 22 MB is 80,000 entries, and every statement here runs once per entry. The
# An agent log of 15 MB is 80,000 entries, and every statement here runs once per entry. The

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

15 MB is the figure the 0.28.0 changelog recorded for the same 80,000-entry log the benchmark used; the 22 MB here predated that measurement. Only the comment changes.

Comment thread README.md
09-28 07:11:22.504 AppWorkload EspComplete
09-28 07:12:22.658 IntuneManagementExtension EspNontrackedCheckin True
EspAppState, EspPhaseComplete, EspComplete, EspNontrackedCheckin |
Format-Table Time, Log, Event, Detail

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The block below shows four columns, and the default view prints Message too, so the command now selects what the block shows. The column widths are what Format-Table gives these values once IntuneManagementExtension prints as Agent; the rows are the round-8 values unchanged.

@fadwen
fadwen merged commit 01dd805 into main Oct 10, 2026
4 checks passed
@fadwen
fadwen deleted the fix/timeline-rolled-log branch October 10, 2026 05:43
@fadwen fadwen mentioned this pull request Oct 14, 2026
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.

1 participant