Python Prompts
Free Prompt
Python Script to Parse Log Files and Generate Statistics
Create a Python script that parses server log files (e.g., Apache, Nginx) and generates statistics
You are a Python developer. Write a script that reads an access log file and extracts useful statistics: number of requests per IP, most requested pages, HTTP status codes, etc. The script must: 1) Accept log file path, 2) Use regular expressions to parse log lines, 3) Count occurrences, 4) Generate summary report in text or CSV, 5) Create bar charts using matplotlib, 6) Handle large files efficiently (streaming), 7) Provide command-line options for filters (date range, IP). Add comments.