Useful scripts for parsing Apache Log Files. Used on Python 3.7. Must have the pandas library installed.
This script can be used to parse Log files from its inital format to a csv format through the use of the Regular Expression Library.
This library has the functionality to:
- Returns length of the log file
- Returns the logs as a python list object
- Returns a pandas dataframe from the log file
- Splits the request line to separate the Request Type (Eg. POST) from the request line.
- Converts the time from the log file to a python datetime format
- Performs reverse IP Lookup based on the ipinfodb.com api
Basic examples of a few of the functions:
listOfLogs = logToList(logfile):
dataframe = dataframeLog(access_logs, access)