OverviewDeveloperHacker

LogQL-lite: A Tiny Filter Language for Log Files

Advanced0 enrolled · 0 submitted

Want in? Run /enroll in Discord to claim this tier before the build window closes.

The brief

Design and implement a small query language for filtering structured log lines, shipped as a library plus a thin CLI.

Example queries: level = "error" AND (service = "api" OR latency_ms > 500)

Core scope:

  • A tokenizer and parser (hand-written recursive descent is ideal) that produces an AST.
  • An evaluator that runs the AST against JSON-lines log records.
  • Helpful error messages that point at the position of a syntax error.
  • A CLI such as logql 'level="error"' app.log that streams matching lines.

Generate fake log data with a small script. No external services are involved. Focus on clean design and solid tests rather than performance tuning.

Deliverables

  • Library and CLI in a public repo, with a grammar documented in the README
  • A test suite covering valid queries, precedence rules, and at least 5 error cases
  • A fake-log generator script and a short demo session showing several queries
  • A short design note on why you chose your grammar and what you left out

Resources

  • Crafting Interpreters (craftinginterpreters.com), especially the scanning and parsing chapters
  • Pratt parsing and recursive descent tutorials
  • JSON Lines format spec (jsonlines.org)
  • Your language's testing framework, plus property-based testing tools like Hypothesis or fast-check if you want a stretch goal