Signal9Signal9 — home
online
back to labs

jq: Aggregate a JSON Metrics Report

MediumCommand Line Essentials10-20 min
The brief

Aggregate a JSON metrics report with jq. The data is /root/case/metrics.json, an array of {"service":"auth","requests":523,"errors":4}. Produce three answers:

  • /root/case/total_requests.txt — sum of every service's requests
  • /root/case/worst.txt — the service with the most errors
  • /root/case/busy.txt — how many services have requests >= THRESHOLD (see assignment.env)

Data varies per session. See /root/case/brief.txt.

What you'll do
  • Sum a numeric field with add
  • Find the record with the maximum of a key using max_by
  • Count a filtered subset with select() + length
  • Print raw output with -r

Hands-on lab: you work on a real Linux box in your browser, graded on the machine's actual state.