Turn JSON Logs Into Readable Lines
The app writes one JSON object per line to /srv/lab/app.jsonl, for example:
{"ts":"2026-11-05T10:00:01Z","level":"error","service":"indexer","msg":"db timeout","req":"r-17"}
A few lines from a crashing library are plain text, not JSON.
Write /home/student/bin/errors.sh FILE SERVICE that prints, for every JSON line of SERVICE with level warn, error or fatal (any letter case), one line:
<ts> <LEVEL in upper case> <msg>
in file order. Lines that aren't valid JSON, or that lack a field, are skipped without breaking the output. Then run it on /srv/lab/app.jsonl for indexer and save the output to /home/student/indexer-errors.txt.
About this machine
Ubuntu 24.04 with no internet access. You are student with passwordless sudo. The grader checks the final state of the machine, not the commands you typed. Values like names and ports are generated for you.
Part of Shell Scripting for Automation. Next step: set -euo pipefail
Teaching or writing about this? Embed this lab on your page
Your machine is ready to start
A fresh, isolated Ubuntu machine boots in a few seconds with the task already set up.
No account needed: 3 of 3 free tries left. Guest machines last 30 minutes.