kelora 0.9.1

A command-line log analysis tool with embedded Rhai scripting
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
# Documentation Improvements

Review completed: 2025-11-11

## Executive Summary

**Overall Rating:** 7.5/10 - Excellent foundation, needs new-user onboarding polish

**Strengths:**
- Excellent Diátaxis structure (Tutorials, How-To, Concepts, Reference)
- Comprehensive coverage with executable examples
- Logical learning path and good cross-referencing
- High-quality tutorial content

**Gaps:**
- Written for users who already understand log processing concepts
- Terminology used before definition
- Stage ordering confusion (filter/exec/levels)
- Missing scaffolding for complete newcomers (glossary, diagrams, FAQ)

---

## High Priority Fixes (Do First)

### 1. ✅ Add a Glossary
**Problem:** Terms like "event", "field", "span", "stage", "window" used throughout but never formally defined up front.

**Solution:** Create `docs/glossary.md` with clear definitions and link prominently from:
- Landing page
- Quickstart
- Basics tutorial
- Navigation footer

**Impact:** Reduces cognitive load for new users trying to understand examples.

---

### 2. Fix Title/Navigation Inconsistencies
**Problem:** `pipeline-model.md` has title "Processing Architecture" but nav shows "Pipeline Model"

**Solution:** Pick one name and use consistently. Recommend "Processing Architecture" as it's more descriptive.

**Files to update:**
- `docs/concepts/pipeline-model.md` (title)
- `mkdocs.yml` (nav entry)
- All cross-references

---

### 3. Add Prominent Stage Ordering Callout
**Problem:** New users will put `--filter 'e.computed_field > 10'` before the `--exec` that creates it.

**Solution:** Add a prominent admonition box in `docs/tutorials/basics.md` (Part 2.5 or Part 3):

```markdown
!!! warning "Stage Order Matters"
    Filters and transforms run in the order you specify them on the CLI.
    Create fields with `--exec` BEFORE filtering on them with `--filter`.

    ❌ Wrong: `kelora --filter 'e.duration_s > 1' -e 'e.duration_s = e.duration_ms / 1000'`

    ✅ Right: `kelora -e 'e.duration_s = e.duration_ms / 1000' --filter 'e.duration_s > 1'`
```

**Also add to:**
- `docs/intro-to-rhai.md` (Step 7)
- `docs/quickstart.md` (after command 3)

---

### 4. Create Quick Reference Page
**Problem:** Users need to search through multiple pages for common patterns.

**Solution:** Create `docs/reference/quick-reference.md` with one-page cheatsheet:
- Common flags and what they do
- Common patterns (filter errors, extract fields, export CSV)
- Stage ordering rules
- Format selection shortcuts
- Debugging tips

**Link from:**
- Navigation (Reference section)
- Landing page footer
- README

---

### 5. Add "Common Issues" Section
**Problem:** New users hit predictable errors with no guidance.

**Solution:** Add FAQ or "Common Issues" section covering:

**In Quickstart or as separate `docs/troubleshooting.md`:**

```markdown
## Common Issues

### "Field not found" or empty output
- Check format is specified: `-j` for JSON, `-f logfmt`, etc.
- Default is `-f line` (plain text)
- Use `-F inspect` to see field names and types

### Filter not working
- Fields must exist before filtering
- Create fields with `--exec` BEFORE filtering on them
- Use `--verbose` to see errors

### Type comparison errors
- String "500" ≠ Integer 500
- Use `.to_int_or(0)` to convert safely
- Use `--filter 'e.status.to_int() >= 500'` for string fields

### No events match filter
- Check level filtering: `-l error` only shows errors
- Use `--stats` to see how many events filtered out
- Verify timestamp filtering with `--since`/`--until`
```

---

## Medium Priority

### 6. Consolidate Performance Pages
**Problem:** Three separate performance pages create navigation overhead.

**Current:**
- `concepts/performance-model.md`
- `concepts/performance-comparisons.md`
- `concepts/benchmark-results.md`

**Solution:** Merge into single `concepts/performance.md` with sections:
1. **When to Optimize** - Decision tree for sequential vs parallel
2. **Performance Model** - Streaming, memory usage, throughput
3. **Benchmarks** - Real-world numbers
4. **Comparisons** - vs jq, awk, grep
5. **Tuning Guide** - Batch size, threads, optimization tips

---

### 7. Add Visual Pipeline Diagram
**Problem:** Text-only explanation of pipeline is hard to grasp.

**Solution:** Add a simple flowchart to landing page and pipeline-model page:

```
┌─────────┐    ┌────────┐    ┌──────────┐    ┌────────┐
│  Input  │ -> │ Parse  │ -> │  Stages  │ -> │ Output │
│ (files) │    │ (json) │    │ (filter) │    │ (json) │
└─────────┘    └────────┘    └──────────┘    └────────┘
                                    |
                              ┌─────┴─────┐
                              │   --exec  │
                              │  --filter │
                              │  --levels │
                              └───────────┘
```

Create simple ASCII or mermaid diagram showing data flow.

---

### 8. Split Dense Pipeline Model Page
**Problem:** 588 lines covering everything is overwhelming.

**Solution:** Split into two pages:
- `concepts/pipeline-basics.md` - Input → Parse → Filter → Output (core concepts)
- `concepts/pipeline-advanced.md` - Spans, parallel mode, batching, context lines

**Or:** Add executive summary/TL;DR at top with jump links.

---

### 9. Add "When NOT to Use Kelora" Section
**Problem:** Users waste time trying to use tool for wrong use cases.

**Solution:** Add to landing page or Concepts:

```markdown
## When NOT to Use Kelora

Kelora excels at streaming log analysis with custom logic, but isn't ideal for:

- **Quick grep/awk jobs** - Use grep/awk for simple pattern matching
- **SQL-style joins** - Use DuckDB, ClickHouse, or SQLite for relational queries
- **Real-time dashboards** - Use Grafana, Kibana, or Datadog for visualization
- **Log storage** - Use Elasticsearch, Loki, or S3 for archival
- **Binary log formats** - Kelora works with text-based formats only

**Best for:** Ad-hoc analysis, ETL pipelines, streaming transforms, custom parsing
```

---

### 10. Create Troubleshooting Guide
**Problem:** No systematic debugging approach for users stuck on errors.

**Solution:** Create `docs/troubleshooting.md` with:

**Debugging Workflow:**
1. Use `-F inspect` to see field types
2. Use `--verbose` to see error messages
3. Use `--stats` to see processing summary
4. Test with `--take 10` for quick iteration
5. Use `--strict` to fail fast on errors

**Common Error Patterns:**
- Parse errors → Check format selection
- Filter errors → Check field existence with `e.has("field")`
- Type errors → Use safe conversions like `.to_int_or(0)`
- Performance issues → Consider `--parallel` for large files
- Empty output → Check level filtering, format detection

**Exit Codes:**
- 0 = Success
- 1 = Parse/runtime errors
- 2 = Invalid CLI usage

---

## Low Priority (Nice to Have)

### 11. Comparison Table with Other Tools
Add to landing page or concepts:

| Tool | Best For | Kelora Advantage |
|------|----------|------------------|
| grep | Pattern matching | Structured field access, transformations |
| awk | Column processing | Type-aware, nested fields, metrics |
| jq | JSON manipulation | Multi-format, filtering, aggregation |
| Python | Complex logic | No setup, streaming, CLI-first |
| Logstash | ETL pipelines | Lightweight, no JVM, Rhai scripting |

---

### 12. Video/GIF Walkthroughs
Create short screencasts for:
- Quickstart (5 min)
- Error triage workflow (3 min)
- Custom parsing (3 min)

---

### 13. Migration Guides
Create guides for users coming from:
- jq users → Kelora equivalents
- awk users → Kelora patterns
- grep users → Filtering approaches

---

### 14. Extended Examples Repository
Separate from how-tos, create `docs/examples/` with:
- One-liners for common tasks
- Script snippets library
- Copy-paste templates

---

## Content Issues to Address

### Landing Page (index.md)

**Problem:** "What It Does" section overlaps heavily with Quickstart.

**Solution Options:**
1. **Remove section** - Link directly to Quickstart instead
2. **Tell a story** - Make three examples show progression: Problem → Detection → Solution
3. **Keep one example** - Show most compelling use case, link to Quickstart for more

**Recommendation:** Keep one compelling example, link prominently to Quickstart.

---

### Core Concepts Introduced Too Late

**Problem:** "Event" mentioned everywhere but not explained until tutorial Part 2.5.

**Solution:** Add brief explanation on landing page:

```markdown
## How It Works

Kelora parses each log line into an **event** - a structured object (map) with fields you can access and manipulate using Rhai scripts.

For example, after parsing this JSON:
\`\`\`json
{"timestamp": "...", "level": "ERROR", "message": "..."}
\`\`\`

You can filter with `--filter 'e.level == "ERROR"'` where `e` is the event and `e.level` accesses the level field.
```

---

### Format Flag Inconsistency

**Problem:** Examples use `-j`, `-f json`, `--input-format json` interchangeably without stating equivalence.

**Solution:** Add to Quickstart after first command:

```markdown
!!! tip "Format Shortcuts"
    `-j` is shorthand for `-f json`. These are equivalent:
    - `kelora -j app.log`
    - `kelora -f json app.log`
    - `kelora --input-format json app.log`

    This guide uses `-j` for brevity.
```

---

### Terminology Consistency

**Current inconsistencies:**
- "150+ functions" vs "150+ built-in functions" vs "150+ built-in Rhai functions"
- "Pipeline Model" vs "Processing Architecture"
- Mix of short/long flag notation

**Recommendation:**
- Use "150+ built-in functions" everywhere
- Pick one: "Processing Architecture" (clearer for new users)
- Short flags in examples, long flags in prose: "Use `-e` (short for `--exec`) to transform events"

---

### Development Approach Section

**Problem:** Appears on both README and landing page (index.md).

**Solution Options:**
1. Remove from landing page, keep in README only
2. Move to separate "About" page
3. Move to footer with link "About This Project"

**Recommendation:** Keep on landing page but move to bottom (after License). It's important context but shouldn't be in "Get Started" path.

---

## Missing Documentation

### For New Users
1. ✅ Glossary (HIGH PRIORITY)
2. Visual pipeline diagram
3. "When NOT to use Kelora"
4. Common error messages with solutions
5. FAQ section

### For Learning
6. Quick reference card (HIGH PRIORITY)
7. Comparison table with other tools
8. Common gotchas page
9. Troubleshooting guide (MEDIUM PRIORITY)

### For Operations
10. Performance tuning guide (part of consolidated performance page)
11. Debugging workflow (part of troubleshooting guide)
12. Exit code reference (exists but needs better linking)

### For Reference
13. Complete CLI flag table (single page with all flags)
14. Rhai script snippets library

---

## Structural Improvements

### Navigation Improvements

**Add to mkdocs.yml nav:**
```yaml
- Getting Started:
    - Home: index.md
    - Quickstart: quickstart.md
    - Glossary: glossary.md
    - Troubleshooting: troubleshooting.md
```

**Add footer links:**
- Quick Reference
- Glossary
- FAQ
- Troubleshooting

---

### Learning Path Improvements

**Current flow:** Home → Quickstart → Basics → Intro to Rhai → ...

**Enhancement:** Add "learning checkpoint" boxes at end of each tutorial:

```markdown
## ✓ You've Learned

- [ ] Specify formats with `-f` and `-j`
- [ ] Filter levels with `-l error,warn`
- [ ] Select fields with `-k field1,field2`
- [ ] Export with `-F csv` or `-J`

**Next:** Learn to write custom filters and transforms in [Introduction to Rhai](intro-to-rhai.md)
```

---

### Cross-Reference Improvements

Add consistent "See Also" sections with:
- Related concepts
- Related how-tos
- Related reference pages

Format:
```markdown
## See Also

**Concepts:**
- [Events and Fields]../concepts/events-and-fields.md - Event structure details

**How-To:**
- [Triage Production Errors]../how-to/find-errors-in-logs.md - Apply these basics

**Reference:**
- [CLI Reference]../reference/cli-reference.md - Complete flag list
```

---

## Specific Page Improvements

### Quickstart
- Add explanation of "why each step matters" between three commands
- Add "Format Shortcuts" tip box
- Add "Common Issues" section at end
- Add learning checkpoint

### Basics Tutorial
- Add stage ordering warning prominently
- Add "Understanding Events" earlier (currently Part 2.5, should be Part 1.5)
- Add learning checkpoint at end

### Intro to Rhai Tutorial
- Emphasize type awareness earlier
- Add more examples of type conversion failures
- Add debugging workflow section

### Pipeline Model (Processing Architecture)
- Add TL;DR section at top
- Add visual diagram
- Consider splitting into basics/advanced

### How-To Guides
- Add "Prerequisites" section to each (what you need to know)
- Add "Time to complete" estimate
- Add "Common variations" for each recipe

### Reference Pages
- CLI Reference: Add single-table overview of all flags
- Functions Reference: Already excellent, no changes needed
- Add Quick Reference page (new)

---

## Implementation Order

### Phase 1: Critical Fixes (Week 1)
1. Create glossary.md
2. Fix title/nav inconsistencies
3. Add stage ordering callouts
4. Add common issues to Quickstart
5. Fix terminology consistency

### Phase 2: New Content (Week 2)
6. Create quick-reference.md
7. Create troubleshooting.md
8. Consolidate performance pages
9. Add visual pipeline diagram
10. Split pipeline-model.md

### Phase 3: Polish (Week 3)
11. Add "When NOT to use" section
12. Add learning checkpoints
13. Improve cross-references
14. Add comparison table
15. Update navigation structure

### Phase 4: Nice-to-Have (Future)
16. Video walkthroughs
17. Migration guides
18. Extended examples repository
19. FAQ page

---

## Success Metrics

**How to measure improvement:**
1. **Time to first success** - Can a new user run a successful filter in < 10 minutes?
2. **Concept clarity** - Do users understand "event", "stage", "format" before using them?
3. **Error recovery** - Can users debug common issues without external help?
4. **Feature discovery** - Can users find advanced features when needed?

**Before/After Test:**
- Have 3-5 new users try Quickstart
- Note where they get stuck
- Measure completion time
- Collect confusion points
- Repeat after improvements

---

## Notes

- Documentation is already very good - these are polish improvements
- Executable examples (markdown-exec) are a huge strength
- Tutorial quality is high - just needs better scaffolding
- Main gap is onboarding for complete newcomers
- Structure (Diátaxis) is excellent and should be preserved