Python code: List most popular URL from Apache/NGINX ‘access.log’ file
Found a great Python code snippet for listing the most popular URL from Apache / NGINX ‘access.log’ file. Very practical! import collections logfile = open(“access.log”, “r”) clean_log=[] for line in logfile: try: # copy the URLS to an empty list. # We get the part between GET and HTTP clean_log.append(line[line.index(“GET”)+4:line.index(“HTTP”)]) except: pass counter = collections.Counter(clean_log) […]