Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Log Parsing A log is the automatically produced and time - stamped documentation of events relevant to a particular system. You are given a list

Log Parsing
A log is the automatically produced and time-stamped documentation of events relevant to a particular system.
You are given a list of N logs in Apache Extended Log File Format (explained below). Each log is a string containing exactly 150 characters. You are also given a date-time interval [(start_date. start time),(fmish_date, finish_time)].
Print the number of logs that represent successful requests within the given date time Interval
Example of a log in the specified format
172.126.12.39 AWAY (10/07/2017:19:45:32)_PUT_/bannerad/ad5.gif
Note
*The different fields in a log are separated by 2 consecutive underscores Different parts of the same field are separated using one underscore"
*Each log is of length 151 characters. The last character of each log is the newline character "In". The remaining length of each log (<150) is filled using underscores to make the length of the log as 151.
Description of Fiels:
1. User IP Address
2. RFC931-(used to log the domain for multi-homed web servers)3. Date/Time - the Time is in 24 hr format
4. Action The particular operation of the hit (this is specified in
quotes)5. Return Code - The return code indicates whether or not the
action was successful etc. (mentioned below)
6. Size (of file sent)
7. Browser/Platform - The web browser and platform used by the
user accessing your site
A request is said to be successful if it's Return Code within the range (400,599]
does not lie
The start date and finish_date are given in the dd/mm/yyyy format.
A request is said to be successful if it's Return Code does not lie within the range (400,599).
The start date and finish_date are given in the dd/mm/yyyy format.
The start time and finish_time are given in the standard 24 hr clock format (hh:mm:ss). These times are given in GMT.
Task
Q
Pint the count of successful logs which lie within the given date-time
Example
122.106.125.155 HOME [21/06/2012:15:43:50]_'PUT_/bannerad/ad.ht 138.72.50.156 HOME [01/05/2005:23:48:33]_GET_/bannerad/ad5.g 167.82.255.158_HOME_[05/07/2013:16:31:19]_GET_/bannerad/ad7.gi 55.136.240.162 HOME_[15/08/2007:23:42:18)_GET_/bannerad/ad5.18.220.176.61 HOME__(08/08/2002:05:30:00) GET_/bannerad/ad.ht
Given Time: [(28/08/200104:28:47)(03/09/2008","20:29:00)
Output
3
Approach
The following 3 requests lie within the given time range, and are
successful.
HOME (01/05/2005:23:48:33]_GET_/bannerad/ad5.g
138.72.50.156
55.136.240.162 HOME [15/08/2007:23:42:18]_GET_/bannerad/ad5..
18.220.176.61 HOME 108/08/2002:05:30:00] "GET_/bannerad/ad.ht
Hence, the answer is
Function description
Complete the function solve provided in the editor. This function takes the following 5 parameters and returns the required answer:
logs_list: A list (vector) of logs. Each member of the list is a string of 151 characters, representing a log.
start_date: The starting date (a string) in "dd/mm/yyyy" format.
start time: The starting time (a string) in standard 24-hr format
(hh:mm:ss).
finish_date: The finish date (a string) in "dd/mm/yyyy" format.
finish_time: The finish time (a string) in standard 24-hr format
(hh:mm:ss).
Input format
Note: This is the input format that you must use to provide custom Input (available above the Compile and Test button).
The first line contains N, the number of logs in the list
The next lines contain strings (one in each line)(each string
has 151 characters), denoting logs.
The third line contains 4 space-separated strings, denoting the start date, start time, finish_date and finish_time in the specified formats.
Output format
Print the answer in the given format.
The first and only line contains an integer N, the count of
successful logs within the given time frame.
Constraints
1

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Master The Art Of Data Storytelling With Visualizations

Authors: Alexander N Donovan

1st Edition

B0CNMD9QRD, 979-8867864248

More Books

Students also viewed these Databases questions