Skip to main content

Module logparse

Module logparse 

Source
Expand description

Log-line parsing — “JSON → columns” (M1.2).

Multi-pod/multi-container log streaming with a regex filter lands the raw line; this module turns structured (JSON) log lines into typed columns so a frontend can show a real table instead of a monochrome string. It is renderer-agnostic: the view-model owns meaning (which columns exist and their typed values); the frontend owns geometry (column widths, truncation).

The schema is inferred from the first JSON line’s keys (stable, first-seen order). Non-JSON lines are returned as a single _raw column. This is deliberately cheap — the full OpenAPI/CRD schema validation lands in Phase 2 with the lens engine.

Structs§

ParsedLogLine
One parsed log row: the raw line plus a typed column map (empty for non-JSON lines).

Enums§

LogCell
A single typed log cell.

Functions§

infer_columns
The inferred column schema for a set of parsed lines (first-seen key order is stable because BTreeMap sorts keys).
parse_json_line
Parse a JSON log line into typed columns. Returns None for non-JSON lines (the caller keeps the raw line for a _raw column).
parse_log_stream
Parse a stream of log lines: JSON lines become typed columns, plain lines keep only the raw text.