Parse the Log File
awk, sed, cut, sort, uniq — extract stats from server logs like a data engineer.
A intermediate Linux challenge worth 10 points. Solve it hands-on in a real Linux environment in your browser - no local setup, no fake shells.
The Challenge
Scenario: Monday morning ops report. The manager wants web traffic stats from last night.
The file /tmp/logs/access.log is a standard nginx access log.
Your tasks:
- Count total requests per HTTP method (GET, POST, etc.) → save to /tmp/method_counts.txt (format: "count METHOD")
- Extract all unique client IP addresses, sorted → save to /tmp/unique_ips.txt
- Find the top 5 most requested URLs → save to /tmp/top_urls.txt (format: "count /path")
Commands to learn: awk, cut, sort, uniq -c, head, sed
Run check when done.