A comprehensive nginx access log analysis tool that generates detailed summary reports using standard Unix command-line tools. This project demonstrates advanced bash scripting and system administration skills through practical log processing.
This task parses nginx access logs and generates a structured summary report containing:
- Request Statistics: Total requests and unique IP addresses
- Status Code Analysis: Breakdown of HTTP response codes
- Traffic Patterns: Top requested paths and most active IP addresses
- Bandwidth Usage: Total bytes transferred
NGINX ACCESS LOG SUMMARY REPORT
================================
Total Requests: 12
Unique IP Addresses: 4
Status Code Breakdown:
- 200: 8 requests
- 500: 1 requests
- 404: 1 requests
- 403: 1 requests
- 302: 1 requests
Top 3 Most Requested Paths:
1. /styles.css - 1 requests
2. /nonexistent.html - 1 requests
3. /index.html - 1 requests
Top 3 IP Addresses by Request Volume:
1. 192.168.1.100 - 4 requests
2. 203.0.113.25 - 3 requests
3. 10.0.0.50 - 3 requests
Total Bytes Transferred: 19136 bytes
- Bash scripting with advanced text processing
- AWK for field extraction and data manipulation
- Unix tools:
grep,sort,uniq,wcfor data analysis - Docker for containerized execution environment
- Robust log parsing with proper field extraction from quoted HTTP requests
- Efficient data processing using Unix pipelines
- Comprehensive error handling with input validation
- Deterministic output suitable for automated testing
parse-nginx-logs/
βββ access.log # Sample nginx access log data
βββ solution.sh # Main bash script for log analysis
βββ task.yaml # Task configuration and metadata
βββ Dockerfile # Container environment setup
βββ docker-compose.yaml # Multi-container orchestration
βββ run-tests.sh # Test execution script
βββ tests/
βββ test_outputs.py # Comprehensive pytest test suite (9 tests)
The project includes a comprehensive test suite that validates:
- β Report file generation
- β Correct data structure and formatting
- β Accurate request counting and IP analysis
- β Proper status code breakdown
- β Top paths and IPs identification
- β Byte transfer calculations
Test Results: 9/9 tests passing (100% success rate)
- Docker and Docker Compose
- Unix-like environment (Linux/macOS)
-
Execute the log parser:
bash solution.sh
-
Run comprehensive tests:
bash run-tests.sh
-
View the generated report:
cat summary_report.txt
# Run with oracle agent
uv run tb run --agent oracle --task-id parse-nginx-logs
# Interactive debugging
uv run tb tasks interact -t parse-nginx-logsThe parser handles standard nginx access log format:
IP - - [timestamp] "METHOD path HTTP/version" status size "referer" "user-agent"
Example:
192.168.1.100 - - [03/Aug/2025:10:15:32 +0000] "GET /index.html HTTP/1.1" 200 1024 "-" "Mozilla/5.0..."
This project demonstrates:
- Advanced bash scripting with complex text processing
- Unix tool mastery for efficient data pipeline construction
- System administration skills for log analysis workflows
- Container deployment with proper environment configuration
- Test-driven development with comprehensive validation
- Web server monitoring and traffic analysis
- Performance optimization through request pattern identification
- Security analysis via IP and path monitoring
- Capacity planning using bandwidth and request metrics
- Automated reporting for system administration tasks
- Efficient processing of large log files using Unix pipelines
- Memory optimized through streaming data processing
- Fast execution leveraging optimized system tools
- Scalable architecture suitable for production environments
This project is part of an assessment submission and demonstrates practical bash/Linux expertise for educational and evaluation purposes.
Created by: David Arnal Date: August 3, 2025