jq CLI Recipes/Filter error logs

Return only error-level JSON log lines.

Section: Logs and Reporting

Filter error logs

bash
bash
cat app.log | jq 'select(.level == "error")'
Explanation

Simple and effective for local debugging.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Logs and Reporting
Extract log levels
Read a field from each JSON log line.
OpenIn sheetbashsame section
Count logs by level
Aggregate log frequency by level.
OpenIn sheetbashsame section
Turn JSON logs into TSV
Extract selected fields into tab-separated text.
OpenIn sheetbashsame section
Build Markdown table rows
Create Markdown-friendly rows from JSON data.
OpenIn sheetbashsame section
Convert env vars into JSON object
Build JSON from shell variables.
OpenIn sheetbashsame section
Filter running EC2 instances
List only instances in the running state.
OpenIn sheetbash2 tag match