← All labs

// hands-on lab

Find Failed Requests and Extract Status Codes

~8 min

Investigate an Nginx access log to find failed HTTP requests and extract their status codes using grep, awk, sort, and shell redirection.

Find Failed Requests and Extract Status Codes

Your Nginx server is reporting failed requests. Use the terminal to investigate the access log.

Start by finding requests with 4xx or 5xx HTTP status codes.

Then:

  1. Use grep to find failed requests.
  2. Use awk to extract the HTTP status code.
  3. Use sort to organize the results.
  4. Use > to save the status codes to failed-status.txt.
  5. Use cat to read the saved results.

The goal is to build a simple log-analysis pipeline:

grep → awk → sort → redirection → cat

// checklist 0/4

Sign in to save checklist progress.

Linux sandbox (WebVM) · ephemeralOpen in new tab ↗

Click Start sandbox for an in-browser Linux environment.

No Docker on the server — the sandbox runs in your browser (or an embedded lab host).