Add SQL over logs (kdb.logs / kdb.stats) - #5671
Conversation
Expose the node's own CLEF log files as queryable views over the existing Arrow Flight SQL surface in the SecondaryIndexing plugin. - LogViews: creates kdb.logs / kdb.stats as per-query TEMP views over the node's log directory via read_json_objects, with a typed zero-row fallback when no files match (read_json errors on an empty set / fresh node). The main-log predicate excludes log-* siblings so it holds for any RollingInterval, including the undated log.json. - render_message scalar function: renders CLEF @mt templates using @r for format-specifier tokens, falling back to JSON properties; degrades to the raw template rather than failing the query on an odd line. - QueryEngine rewriter: maps the kdb schema's logs/stats tables to the views and creates them on the executing connection per query. - csproj: AllowUnsafeBlocks (VARCHAR scalar inputs have no managed accessor) and a Serilog reference for the template parser.
Cover the kdb.logs and kdb.stats tables on the Arrow Flight SQL surface: column lists, example queries, and the read-only, node-local semantics. - Flight SQL page: new "Querying node logs" section beside kdb.records / usr.* - Database logs page: cross-link to it under a "Querying logs with SQL" section
Deploying eventstore with
|
| Latest commit: |
e979de6
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://2c8afb79.eventstore.pages.dev |
| Branch Preview URL: | https://logs-query.eventstore.pages.dev |
PR Summary by QodoExpose node CLEF logs as SQL tables (kdb.logs / kdb.stats)
AI Description
Diagram
High-Level Assessment
Files changed (11)
|
Code Review by Qodo
1.
|
- name the logs/stats boolean arguments at the LogViews.Create call sites - swallow IO/permission errors when enumerating log files, degrading to empty views like the other log-read failure modes (missing dir, ignore_errors on read) - delete the integration fixture's temp log directory on teardown
Exposes a node's own CLEF log files as two queryable tables,
kdb.logsandkdb.stats, over the existing Arrow Flight SQL surface in the SecondaryIndexing plugin. Read-only and node-local: a query only sees the log files on the node it connects to.LogViewscreateskdb.logs/kdb.statsas per-query TEMP views over the node's log directory viaread_json_objects, with a typed zero-row fallback when no files match (read_jsonerrors on an empty set / fresh node). The main-log predicate excludeslog-*siblings so it holds for anyRollingInterval, including the undatedlog.json.render_messagescalar function renders CLEF@mttemplates, taking format-specifier tokens from the@rrenderings and falling back to the JSON properties. It degrades to the raw template rather than failing the whole query on a malformed line.QueryEnginerewriter maps thekdbschema'slogs/statstables to the views and creates them on the executing connection per query, alongside the existingrecordsmapping.LogViewsTests, unit) and the end-to-end Flight SQL surface (LogsFlightSqlTests, integration): every level, message rendering, cross-viewUNION, time-bounded queries, and rejection of non-SELECT/ unqualified-view / unknown-table access.