Search

7 Best Tools for Querying JSON Logs

Learn about seven tools for JSON log querying, from jq style filters to interactive viewers and SQL engines, for faster debugging of structured log data.

On this page
  1. Key takeaways
  2. Why JSON log querying matters
  3. Quick comparison
  4. The best tools for querying JSON logs
  5. How we chose
  6. FAQ
  7. Sources

Key takeaways

  • JSON log querying turns messy structured output into filtered, sorted, and reshaped results you can read quickly.
  • jq and gojq filter with a compact language, while jless and lnav make exploring interactive.
  • gron and angle-grinder simplify searching and summarizing, and DuckDB brings full SQL to JSON files.
  • Pick based on whether you want one off filters, an interactive session, or SQL analytics.

Why JSON log querying matters

Structured logs are everywhere, because every modern app and platform emits JSON lines. The problem is that a wall of JSON is hard to read and even harder to search with grep. Dedicated querying tools parse the structure, so you can filter by field, group by value, and reshape output.

These tools fall into a few camps. Some are filters with a small query language, some are interactive viewers, and one is a full SQL engine. Together they cover the quick one liner, the careful exploration, and the large analytical pass over a JSON log file.

Quick comparison

ToolBest forStarting priceFree plan
jqFiltering and reshaping JSON on the command lineNot includedNot included
gojqA fast, portable jq compatible filterNot includedNot included
jlessInteractive browsing of large JSON filesNot includedNot included
gronMaking JSON grepable line by lineNot includedNot included
angle-grinderSummarizing log files on the command lineNot includedNot included
lnavTailing and exploring logs in a terminalNot includedNot included
DuckDBSQL queries over JSON log filesNot includedNot included

The best tools for querying JSON logs

1. jq

  • Official site: https://jqlang.org/
  • Best for: Filtering and reshaping JSON on the command line
  • Starting price: Not included
  • Free plan: Not included
  • Pros: The standard JSON filter language; very expressive and widely documented
  • Cons: Dense syntax to learn; some queries are hard to read later

jq is the reference tool for filtering JSON. It reads a stream of JSON values, applies a filter expression, and prints the result, so a one liner can extract fields, select matching objects, and reshape output into compact tables.

jq is installed almost everywhere and has extensive documentation, which makes it the first tool most engineers reach for. Its syntax is compact and powerful, though complex filters can become hard to maintain.

2. gojq

  • Official site: https://github.com/itchyny/gojq
  • Best for: A fast, portable jq compatible filter
  • Starting price: Not included
  • Free plan: Not included
  • Pros: Drop in jq compatibility; ships as a single static binary
  • Cons: Smaller feature surface than jq in some areas; fewer platform packages

gojq is a reimplementation of jq written in Go. It aims for compatibility with the jq filter language while distributing as a single static binary that runs on many platforms. For teams that want jq style queries in minimal environments, it is a convenient alternative.

gojq covers the common jq patterns well, which means most everyday log filters work unchanged. Some less common jq features are not implemented, so it is worth checking when a filter relies on an edge case.

3. jless

  • Official site: https://jless.io
  • Best for: Interactive browsing of large JSON files
  • Starting price: Not included
  • Free plan: Not included
  • Pros: Terminal UI for exploring big JSON; easy folding and search
  • Cons: For viewing rather than piping output; less useful in scripts

jless is a terminal viewer for JSON. It opens large files and lets you move through the structure, collapse objects, and search keys and values, much like less works for text. When a JSON log file is too big to page through by hand, jless makes it navigable.

It focuses on exploration rather than transformation, so it complements tools like jq instead of replacing them. You might open a file in jless to understand its shape, then write a jq filter to extract what you found.

4. gron

  • Official site: https://github.com/tomnomnom/gron
  • Best for: Making JSON grepable line by line
  • Starting price: Not included
  • Free plan: Not included
  • Pros: Flattens JSON into grep friendly lines; pairs with standard Unix tools
  • Cons: Output can be verbose on deep objects; best for search not aggregation

gron turns nested JSON into one flat line per value, with a path such as json.error.message on each line. That simple trick makes JSON searchable with plain grep, and the output can be reassembled back into JSON after editing.

gron is deliberately small and plays well with the rest of the Unix toolchain. It does not do aggregation or grouping, so it pairs with jq or DuckDB for heavier questions. Its value is making the first search step trivial.

5. angle-grinder

  • Official site: https://github.com/rcoh/angle-grinder
  • Best for: Summarizing log files on the command line
  • Starting price: Not included
  • Free plan: Not included
  • Pros: Fast aggregation and summarizing of log lines; helpful for spotting patterns
  • Cons: Fewer filters than jq; aimed at tabular summaries not reshaping

angle-grinder is a command line tool for parsing and aggregating logs. It reads lines, parses common formats including JSON, and can group, count, and summarize values so you can see the most frequent errors or slowest endpoints quickly.

It sits between a text tool and a database. It will not reshape JSON as flexibly as jq, but it makes aggregation fast without writing SQL. For a quick answer about what is happening across a log file, it is a very fast path.

6. lnav

  • Official site: https://lnav.org/
  • Best for: Tailing and exploring logs in a terminal
  • Starting price: Not included
  • Free plan: Not included
  • Pros: Understands JSON and common log formats; rich terminal interface
  • Cons: Interactive by design, so less suited to scripts; format detection can miss odd files

lnav, short for log file navigator, is a terminal tool for viewing and searching logs. It detects formats including JSON lines, merges several files into one time ordered view, and offers search, filters, and SQL queries against the loaded files.

For JSON logs, lnav can parse fields and expose them through its own query interface, which saves writing filters by hand for simple questions. It is interactive, so it suits an operator watching logs during an incident.

7. DuckDB

  • Official site: https://duckdb.org/
  • Best for: SQL queries over JSON log files
  • Starting price: Not included
  • Free plan: Not included
  • Pros: Full SQL over JSON and Parquet; fast analytical scans
  • Cons: More setup than a one liner; single node only

DuckDB brings SQL to JSON logs. It can read JSON and newline delimited JSON directly, then answer grouping, filtering, and aggregation questions with standard SQL. Where jq filters one line at a time, DuckDB excels at whole file questions such as top error types.

It is embedded, so there is no server to run, and it pairs naturally with files in object storage. The cost is a little more ceremony than a one line jq filter, since you write a query.

How we chose

We picked tools that handle different stages of working with JSON logs. Some filter and reshape, some make exploration interactive, one flattens JSON for grep, and one adds SQL for aggregation. That spread reflects how a debugging session moves from a first look to a full analysis.

All of these tools are free, open, and run locally, which keeps them easy to try on real data without a server. We favored tools with active maintenance and clear docs, and we kept the list focused on the command line.

FAQ

Is jq enough for most JSON log queries?

For filtering, extraction, and reshaping, jq handles nearly everything most people need. It only falls short when you want full SQL aggregation or an interactive browsing view, which is where DuckDB and jless help.

How do I query a JSON log that is one object per line?

Treat it as newline delimited JSON. jq and DuckDB both read that format directly, and gron can flatten each line into grep friendly paths. Confirm the tool is reading each line as a separate JSON value.

Can I use these tools on large log files?

Yes, within limits. jq, gojq, and angle-grinder stream data and stay fast, while DuckDB scans efficiently on a single machine. For files larger than local memory, DuckDB and jless are usually the most comfortable.

Which tool should I learn first?

Start with jq, because it is the most universal and its skills carry over to gojq and scripting. Add DuckDB when you need SQL aggregation, and jless or lnav when you want to explore interactively.

Do these tools work with logs that are not strict JSON?

Most assume valid JSON, though lnav detects many log formats and can mix them. If lines are only partly structured, parse the text first or use a tool that tolerates the format, then query the valid parts.

Sources