cmtraceopen-parser
Pure-Rust parsing for Windows management and deployment logs — ConfigMgr/SCCM, Intune, CBS, DISM, Panther, MSI, PSADT, and more — with format auto-detection, severity classification, and an embedded Windows error-code database.
This is the parsing engine behind CMTrace Open, extracted as a standalone crate so it can be used without the desktop app.
Why this crate
If you are writing anything that reads Windows deployment logs — a CI log summarizer, a custom triage tool, a bulk analyzer over collected diagnostics — the tedious part is not reading the file. It is knowing that ConfigMgr wraps entries in <![LOG[...]LOG]!>, that older SCCM logs use $$< delimiters, that PSADT and MSI logs each timestamp differently, and that a 0x80070005 in the message means "Access is denied."
This crate does that part.
Design constraints
The crate is deliberately narrow, which is what makes it reusable:
- No I/O. Every entry point takes
&stror&[u8]. You decide where bytes come from. - No async runtime, no
tokio. - No platform lock-in. No
windows/winregcrates, no Tauri, norayon. Windows log formats are parsed anywhere — you can analyze ConfigMgr logs on Linux or macOS. - Compiles to
wasm32-unknown-unknownas well as native targets.
Dependencies are limited to serde, serde_json, regex, chrono, encoding_rs, log, thiserror, and base64.
Install
Quick start
Parse a log and let the crate pick the format:
use parse_content;
use Severity;
let content = read_to_string?;
let = parse_content;
println!;
println!;
for entry in result.entries.iter.filter
parse_content returns a ParseResult (entries, detected format, total lines, parse-error count, byte offset for resuming a tail) plus the ResolvedParser that was selected.
Decoding bytes yourself
Windows logs are frequently not UTF-8. The crate exposes the same encoding fallback the app uses:
use ;
let bytes = read?;
let encoding = detect_encoding; // BOM sniffing, UTF-8 → Windows-1252 fallback
let text = decode_bytes?;
Error-code lookup
Over 700 Windows, Windows Update, BITS, ConfigMgr, Intune, Delivery Optimization, MSI, and PSADT codes are embedded — no network calls:
use ;
let hit = lookup_error_code;
assert!;
println!;
// Find codes inside a message, with byte offsets for highlighting:
for span in detect_error_code_spans
Hex (0x80070005), bare hex (80070005), unsigned decimal, and signed HRESULT (-2147024891) inputs are all accepted.
Skipping detection
If you already know the format, resolve a parser once and reuse it across chunks:
use ;
let selection = detect_parser;
let chunk = parse_content_with_selection;
Supported formats
Detection samples the start of the content and selects a parser automatically.
| Format | Typical source |
|---|---|
| CCM | ConfigMgr / SCCM client logs (<![LOG[...]LOG]!>) |
| Simple | Older SCCM-style logs ($$< delimited) |
| ReportingEvents | Intune Management Extension ReportingEvents.log |
| CmtLog | CMTrace Open structured capture logs |
| CBS / DISM / Panther | CBS.log, dism.log, setupact.log, setuperr.log |
| MSI | Windows Installer verbose logs |
| PSADT (legacy) | PowerShell App Deployment Toolkit |
| Burn | WiX Burn bootstrapper logs |
| PatchMyPc detection | PatchMyPC detection-script output |
| IntuneMacOs | Intune agent logs on macOS |
| IIS W3C | W3C extended-format web logs |
| DHCP | Windows DHCP Server logs |
| DNS debug | Windows DNS Server debug logs |
| Registry | Exported .reg content |
| SecureBootLog | Secure Boot certificate-rotation logs |
| Timestamped / Plain | Any log with, or without, a leading timestamp |
The DnsAudit parser kind exists in the shared models, but DNS audit logs arrive as binary .evtx. EVTX decoding is native-only and lives in the CMTrace Open app, not in this crate.
Beyond the log viewer
The crate also carries the pure-analysis layers the app builds on top of parsing, each usable independently:
| Module | Contents |
|---|---|
parser |
Format detection, per-format parsers, encoding helpers |
models |
LogEntry, ParseResult, Severity, FilterCriteria, parser metadata |
error_db |
Embedded error-code database, lookup, in-message span detection |
intune |
IME event extraction and timeline reduction |
esp |
Autopilot Enrollment Status Page evidence normalization, reduction, and redaction |
dsregcmd |
dsregcmd /status output parsing and diagnostic rules |
collector |
Diagnostic-collection profile models and environment-variable expansion |
Versioning
0.x — the public API may change in minor releases while it settles. Pin an exact version if you need stability.
License
MIT. See LICENSE.
Disclaimer
CMTrace is a tool developed and distributed by Microsoft Corporation. CMTrace Open and this crate are an independent open-source project, not affiliated with, endorsed by, or connected with Microsoft Corporation.