Validate and summarize JSONL request logs with a native MoonBit CLI
Dependencies
moon update
moon test --target native
python3 tests/cli_smoke.py
moon run cmd/main examples/requests.jsonl
moon run cmd/main examples/requests.jsonl --service api --level ERROR --format json
moon run cmd/main examples/requests.jsonl --status 503 --format json
moon run cmd/main examples/requests.jsonl --min-events 1 --fail-on-invalid --max-error-rate 20
moon run cmd/main examples/requests.jsonl --max-p95-ms 100
moon run cmd/main examples/requests.jsonl --max-service-error-rate 30accepted=4 filtered=0 invalid=1 errors=1 error_rate_pct=25 p50_ms=20 p95_ms=150
invalid_lines=5
service="api" requests=3 errors=1 error_rate_pct=33.333333333333336 p50_ms=20 p95_ms=150| Field | Type and rule |
|---|---|
| timestamp | A valid UTC timestamp in whole seconds (2026-09-24T03:00:00Z) or exactly three fractional digits (2026-09-24T03:00:00.250Z); no offsets or leap seconds. |
| service | A nonblank string. |
| level | Exactly DEBUG, INFO, WARN, or ERROR. |
| status | An integer HTTP status from 100 through 599. |
| latency_ms | A finite number from 0 through 86,400,000. |
moon run cmd/main <input.jsonl> [--service NAME] [--level DEBUG|INFO|WARN|ERROR]
[--status 100..599]
[--since YYYY-MM-DDTHH:MM:SSZ] [--until YYYY-MM-DDTHH:MM:SSZ]
[--format text|json] [--max-error-rate PERCENT] [--max-service-error-rate PERCENT]
[--max-p95-ms MILLISECONDS]
[--min-events COUNT] [--fail-on-invalid]moon check --target native
moon test --target native
moon build --target native
moon info
moon fmtpub struct Config {
service : String
level : String
status : Int
since : String
until : String
}pub struct Report {
accepted : Int
filtered : Int
invalid : Int
invalid_lines : Array[Int]
errors : Int
error_rate_pct : Double
p50_ms : Double
p95_ms : Double
services : Array[ServiceStats]
statuses : Array[StatusStats]
}pub struct ServiceStats {
name : String
count : Int
errors : Int
error_rate_pct : Double
p50_ms : Double
p95_ms : Double
}pub struct StatusStats {
service : String
status : Int
count : Int
p50_ms : Double
p95_ms : Double
}fn valid_timestamp(s : String) -> BoolInstall
Download zipValidate and summarize JSONL request logs with a native MoonBit CLI
Dependencies