CLI toolmedium

logq: a command-line log query tool

A streaming CLI that filters and aggregates JSON-lines logs with a small query language.

Suggested effort
~3.5h focused work
Window
24 hours
Starts from
An empty repo
Stack
Your choice
Sign in to start this build →

Opens in a new tab. The clock starts when you press Start inside the environment, not before, and your workspace is kept while you step away.

Time window 24 hours. Suggested effort about 3 to 4 hours.

Context

Services write structured logs as JSON lines. On-call engineers want a fast CLI to filter and summarise them without loading anything into a database.

Core requirements

  • logq FILE [options] reads JSON lines from a file, or from stdin when FILE is -, streaming in constant memory.
  • --where 'level=error', --where 'status>=500', repeatable (all must match). Operators =, !=, >, >=, <, <=, and ~ (substring). Nested fields with dots: http.status>=500.
  • --since and --until on the ts field (ISO 8601).
  • --fields a,b,c prints the selected fields as a table; otherwise matching lines are printed unchanged.
  • --count-by FIELD prints counts per value, sorted descending.
  • Malformed lines are skipped and counted; the count goes to stderr at the end.

Acceptance criteria

  • Commit a sample log (samples/app.log, at least 200 lines) and the script that generated it. logq samples/app.log --where level=error --count-by service prints the right numbers, and the README shows it.
  • Exit codes: 0 when something matched, 1 when nothing matched, 2 on bad usage (with a helpful message).
  • Handles a 1 GB file without reading it into memory (say how you checked).
  • Unit tests for the filter expression parser and integration tests that run the CLI.

Stretch goals (optional)

  • --format csv|json|table.
  • --percentiles FIELD (p50, p95, p99) for numeric fields.
  • Follow mode (-f) like tail -f.
  • Gzip input.

Constraints

  • Any language. Suggested: Python (argparse or typer), Go, Rust or Node.
  • Runnable from the repository with one documented command.

Deliverables (every project)

  • Source code committed in this repository (the grader diffs against the first commit).
  • README.md that replaces the stub, with: how to install, run and test it (copy-pasteable commands); the decisions and trade-offs you made; what you would do next with more time; and a short note on how you used the AI agent (what you delegated, what you checked or rewrote).
  • Automated tests that run with a single command (npm test, pytest, go test ./... or cargo test).
  • No secrets in the repository. Anything configurable reads from environment variables with safe defaults.

Ground rules

  • The 24-hour clock is a window, not a workload. Stop at roughly the suggested effort, then write down what you would do next. A small, finished, tested core beats a large unfinished one.
  • Use the AI agent as much or as little as you like: every prompt is recorded and the report shows how it was used. You are judged on the result and on whether you understood and verified what the agent produced.
  • The work is yours. PraxisAI uses it only to produce your assessment report.
logq: a command-line log query tool: a 24-hour take-home project | PraxisAI