Home / Expert Answers / Computer Science / in-python-nbsp-plan-it-you-are-given-a-log-file-with-a-list-of-responses-some-of-the-records-pa131

(Solved): IN PYTHON   plan it You are given a log file with a list of responses, some of the records ...



IN PYTHON

You are given a log file with a list of responses, some of the records in the log file may contain filenames.
Generate a new hosts_access_log_00.txt
Sample Output 0
Given filename = hosts_access_log_00.txt, process the records in hosts_access_log_0

 

plan it

You are given a log file with a list of responses, some of the records in the log file may contain filenames. Generate a new file containing the unique names of all giffiles that were requested via \( G E T \) and that had a response code of 200. A sample and the structure of the text file containing the responses are given below. Sample log record: burger.letters.com - - [01/Jul/1995:00:00:12 -0400] "GET /shuttle/countdown/video/livevideo.GIF HTTP/1.0" 2000 burger. letters.com - - [01/Jul/1995:00:00:12 \( -0400] \) "GET /images/NASA-logosmall.gif HTTP/1.0" 304 O Log File Structure: Missing column values are denoted by a hyphen (i.e. -). Timestamp Format: DD: day of the month, mmm: name of the month, YYYY: year, HH:MM:SS - 24-hour time format, -0400 is the time zone Given a filename that denotes a text file in the current working directory. Create an output file with the name "gifs_" prefixed to the filename (gifs_filename) which stores the unique gif filenames that match the requirements. Example: filename = "hosts_access_log_00.txt", process the records in hosts_access_log_o0.txt and create an output file named gifs_hosts_access_log_00.txt. Write the name of a GIF file (without its path) to the output file, for each of the records in the input file which satisfy the below: - The GIF file was requested by a GET request. - The record has an HTTP response code of 200. Note: The output file has to be written to the current directory. The line order in the output file does not matter. There must not be any duplicates (if duplicates exist, you will receive only \( 70 \% \) of the score). hosts_access_log_00.txt Sample Output 0 Given filename = "hosts_access_log_00.txt", process the records in hosts_access_log_00.txt and create an output file named gifs_hosts_access_log_00.txt that contains the following rows: livevideo.GIF count.gif NASA-logosmall.gif KSC-logosmall.gif Explanation 0 The log file hosts_access_log_00.txt contains the following log records:


We have an Answer from Expert

View Expert Answer

Expert Answer


We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe