kelora 0.2.2

A command-line log analysis tool with embedded Rhai scripting
Documentation
βœ… Kelora in a Nutshell

Kelora is a fast, scriptable, CLI-native log processor. It turns messy, real-world logs into structured events, lets users filter, enrich, and analyze them using Rhai, and works great in pipelines, CI, and batch modes β€” all without depending on servers or dashboards.

βΈ»

🧠 Settled Design Principles

Area	            Decision / Philosophy
Core Identity	    CLI tool for processing structured logs (not a viewer, shipper, or platform)
Event Model	        Each log line becomes an Event with typed IndexMap<String, FieldValue>
Special Fields	    ts, level, msg are promoted/normalized during parsing, not afterwards
Field Typing	    Default to String; Rhai’s .to_*() + optional try_*() wrappers for safe coercion
Input Formats	    JSON, logfmt, and flexible user-defined formats via -f line + Rhai
Multiline Support	βœ… Needed; planned via pluggable chunkers (inspired by Stelp strategies)
Emit/Fan-out	    βœ… Supported via emit_each() (suppresses original event by default)
Flattening	        get_path() + optional flattening with dot+bracket syntax (user.roles[0])
Error Handling	    Resilient by default with context-specific recovery; strict mode for fail-fast
Script Scope	    Inject valid keys as variables, fallback to event["non_ident"], allow --script
Parallelism	        Controlled via --serial, --unordered, --realtime, --batch-size, etc.
Output Formats	    Minimal and clean: default, JSON, logfmt (only default formatter does styling)
Type Coercion       Explicit only; no auto-coercion of fields
Fan-outg	        emit_each() accepted as best name (alternatives evaluated)
Field Access Style	e["key"], get_path(e, "a.b[0].c") for deep/nested values with safety functions
Strict Vars Mode	Plan to use Engine::set_strict_variables(true) for robustness

βΈ»

πŸ”§ Implemented or Planned Features
	β€’	βœ… try_*() Rhai helpers for ergonomic field coercion
	β€’	βœ… Multiline chunkers based on indentation, regex, or date prefixes
	β€’	βœ… emit_each() with clear suppress + side-effect semantics
	β€’	βœ… Formatter cleanup (formatter_utils.rs)
	β€’	βœ… run_parallel() / run_sequential() refactor in main.rs
	β€’	βœ… Input format sniffing (--format auto)
	β€’	βœ… Metrics tables (--metrics/-m)
	β€’	βœ… Native track_*() functions (count, avg, unique, etc.)
	β€’	βœ… Benchmarking with Criterion.rs
	β€’	βœ… Fuzzing with cargo fuzz
	β€’	βœ… Resiliency model with --strict flag for fail-fast behavior
	β€’	βœ… Clean stream modes UX table (default, serial, realtime, unordered)

βΈ»

πŸ› οΈ In Development / For Immediate Focus

- Nom-based logfmt parser with robust edge case support
- Finalize field extraction and flattening strategy
- Define and inject standard kelora_std Rhai helpers with safety functions
- Build standard tests for fan-out, coercion, emit logic
- Add --config / .kelorarc for persistent options

βΈ»

🧱 Distinctive Traits vs. Other Tools

Tool	        Kelora Is…
jq  	        More structured, stateful, supports multiline, real scripting
awk	            Safer, saner, and field-aware β€” built for logs, not CSVs
lnav	        Not interactive β€” scriptable, batch-oriented, composable in pipelines
angle-grinder	More flexible due to Rhai, chunking, tracked state, and event fan-out
Loki / Vector	Not a log shipper β€” Kelora is a processing tool, not a system

βΈ»

❌ Things You’ve Decided Not to Do

- No auto-coercion of types: Leads to silent failures; better to be explicit
- No implicit fan-out from arrays: Too magical and error-prone
- No implicit flattening: Controlled flattening via helper functions only
- No plugin system or extensions: Overkill; instead expose composable functions via Rhai

βΈ»

πŸ“ Your Preferences as a Developer
	β€’	βœ… Value clarity, minimalism, and control
	β€’	βœ… Tolerate complexity internally to provide clean, predictable behavior externally
	β€’	βœ… Prioritize CLI ergonomics and scriptable UX
	β€’	βœ… Prefer building blocks over opinionated automation
	β€’	βœ… Design for untrusted, inconsistent input (e.g. malformed fields, bad types)
	β€’	βœ… Have learned from previous project (klp) and want to avoid its feature creep

βΈ»

✨ Summary Tagline

Kelora is a scriptable log processor for real-world logs.
Designed for pipelines, CI, and fast triage. One-liners in Rhai. Structured in, structured out. Nothing more β€” and nothing less.