Recipe Difficulty: Medium
Python Version: 3.5
Operating System: Any
Logs from web servers are very useful for generating user statistics, providing us with insightful information about the devices used and the geographical locations of the visitors. They also provide clarification to examiners looking for users attempting to exploit the web server or otherwise unauthorized use. While these logs store important details, they do so in a manner inconvenient to analyze efficiently. If you were to attempt to do so manually, the field names are specified at the top of the file and would require you to remember the order of the fields as you read through the text file. Fortunately, there is a better way. Using the following script, we show how to iterate through each line, map the values to the fields, and create a spreadsheet of properly displayed results...