Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I have a application that writes logs to postgres database in the format attached. You have to create a Flask REST API that connects to
I have a application that writes logs to postgres database in the format attached. You have to create a Flask REST API that connects to the DB and returns the following stats.
a. Number of logs at a certain time. b. Peak time for GET and POST requests. c. Hour wise frequency of logs. d. The ratio of Status code 200 vs other status code for a given URL. e. The 5 most requested URLs.
Staus IP 10.128.2.1 10.128.2.1 10.128.2.1 10.131.2.1 10.130.2.1 10.130.2.1 10.128.2.1 10.131.2.1 10.131.2.1 10.131.2.1 10.131.2.1 10.130.2.1 10.130.2.1 10.130.2.1 10.130.2.1 10.129.2.1 10.131.0.1 10.131.0.1 10.130.2.1 10.131.2.1 10.131.2.1 10.128.2.1 10.131.0.1 10.128.2.1 10.131.0.1 10.129.2.1 10.131.0.1 10.128.2.1 10.131.2.1 10.131.2.1 10.131.2.1 10.131.2.1 10.131.2.1 10.131.2.1 10.131.2.1 10.131.2.1 Time [29/Nov/2017:06:58:55 [29/Nov/2017:06:59:02 [29/Nov/2017:06:59:03 [29/Nov/2017:06:59:04 [29/Nov/2017:06:59:06 [29/Nov/2017:06:59:19 [29/Nov/2017:06:59:19 [29/Nov/2017:06:59:19 [29/Nov/2017:06:59:30 [29/Nov/2017:06:59:37 [29/Nov/2017:06:59:37 [29/Nov/2017:07:00:19 [29/Nov/2017:07:00:21 [29/Nov/2017:13:31:27 [29/Nov/2017:13:31:28 [29/Nov/2017:13:38:03 [29/Nov/2017:13:38:04 [29/Nov/2017:13:38:07 [29/Nov/2017:13:38:19 [29/Nov/2017:13:38:20 [29/Nov/2017:13:38:20 [29/Nov/2017:13:38:20 [29/Nov/2017:13:38:20 [29/Nov/2017:13:38:20 [29/Nov/2017:13:38:20 [29/Nov/2017:13:38:20 [29/Nov/2017:13:38:21 [29/Nov/2017:13:38:21 [29/Nov/2017:13:38:23 [29/Nov/2017:13:46:46 [29/Nov/2017:13:46:50 [29/Nov/2017:13:46:53 [29/Nov/2017:13:46:54 [29/Nov/2017:13:47:04 [29/Nov/2017:13:47:05 [29/Nov/2017:13:47:16 URL GET /login.php HTTP/1.1 POST /process.php HTTP/1.1 GET /home.php HTTP/1.1 GET /js/vendor/moment.min.js HTTP/1.1 GET /bootstrap-3.3.7/js/bootstrap.js HTTP/1.1 GET /profile.php?user=bala HTTP/1.1 GET /js/jquery.min.js HTTP/1.1 GET /is/chart.min.js HTTP/1.1 GET /edit.php?name=bala HTTP/1.1 GET /logout.php HTTP/1.1 GET /login.php HTTP/1.1 GET /login.php HTTP/1.1 GET /login.php HTTP/1.1 GET/ HTTP/1.1 GET /login.php HTTP/1.1 POST /process.php HTTP/1.1 GET /home.php HTTP/1.1 GET /contestproblem.php?name=RUET%2001%20Server%20Testing%20Contest HTTP/1.1 GET/ HTTP/1.1 GET /login.php HTTP/1.1 GET /css/bootstrap.min.css HTTP/1.1 GET /css/font-awesome.min.css HTTP/1.1 GET /cssormalize.css HTTP/1.1 GET /css/style.css HTTP/1.1 GET /js/vendor/modernizr-2.8.3.min.js HTTP/1.1 GET /css/main.css HTTP/1.1 GET /js/vendor/jquery-1.12.0.min.js HTTP/1.1 GET /bootstrap-3.3.7/js/bootstrap.min.js HTTP/1.1 GET /fonts/fontawesome-webfont.woff2?v=4.6.3 HTTP/1.1 GET/ HTTP/1.1 GET /contestproblem.php?name=RUET%2001%20Server%20Testing%20Contest HTTP/1.1 GET /logout.php HTTP/1.1 GET /login.php HTTP/1.1 POST /process.php HTTP/1.1 GET /login.php?value=fail HTTP/1.1 POST /process.php HTTP/1.1 200 302 200 200 200 200 200 200 200 302 200 200 200 302 200 302 200 200 302 200 200 200 200 200 200 200 200 200 200 200 200 302 200 302 200 302 Staus IP 10.128.2.1 10.128.2.1 10.128.2.1 10.131.2.1 10.130.2.1 10.130.2.1 10.128.2.1 10.131.2.1 10.131.2.1 10.131.2.1 10.131.2.1 10.130.2.1 10.130.2.1 10.130.2.1 10.130.2.1 10.129.2.1 10.131.0.1 10.131.0.1 10.130.2.1 10.131.2.1 10.131.2.1 10.128.2.1 10.131.0.1 10.128.2.1 10.131.0.1 10.129.2.1 10.131.0.1 10.128.2.1 10.131.2.1 10.131.2.1 10.131.2.1 10.131.2.1 10.131.2.1 10.131.2.1 10.131.2.1 10.131.2.1 Time [29/Nov/2017:06:58:55 [29/Nov/2017:06:59:02 [29/Nov/2017:06:59:03 [29/Nov/2017:06:59:04 [29/Nov/2017:06:59:06 [29/Nov/2017:06:59:19 [29/Nov/2017:06:59:19 [29/Nov/2017:06:59:19 [29/Nov/2017:06:59:30 [29/Nov/2017:06:59:37 [29/Nov/2017:06:59:37 [29/Nov/2017:07:00:19 [29/Nov/2017:07:00:21 [29/Nov/2017:13:31:27 [29/Nov/2017:13:31:28 [29/Nov/2017:13:38:03 [29/Nov/2017:13:38:04 [29/Nov/2017:13:38:07 [29/Nov/2017:13:38:19 [29/Nov/2017:13:38:20 [29/Nov/2017:13:38:20 [29/Nov/2017:13:38:20 [29/Nov/2017:13:38:20 [29/Nov/2017:13:38:20 [29/Nov/2017:13:38:20 [29/Nov/2017:13:38:20 [29/Nov/2017:13:38:21 [29/Nov/2017:13:38:21 [29/Nov/2017:13:38:23 [29/Nov/2017:13:46:46 [29/Nov/2017:13:46:50 [29/Nov/2017:13:46:53 [29/Nov/2017:13:46:54 [29/Nov/2017:13:47:04 [29/Nov/2017:13:47:05 [29/Nov/2017:13:47:16 URL GET /login.php HTTP/1.1 POST /process.php HTTP/1.1 GET /home.php HTTP/1.1 GET /js/vendor/moment.min.js HTTP/1.1 GET /bootstrap-3.3.7/js/bootstrap.js HTTP/1.1 GET /profile.php?user=bala HTTP/1.1 GET /js/jquery.min.js HTTP/1.1 GET /is/chart.min.js HTTP/1.1 GET /edit.php?name=bala HTTP/1.1 GET /logout.php HTTP/1.1 GET /login.php HTTP/1.1 GET /login.php HTTP/1.1 GET /login.php HTTP/1.1 GET/ HTTP/1.1 GET /login.php HTTP/1.1 POST /process.php HTTP/1.1 GET /home.php HTTP/1.1 GET /contestproblem.php?name=RUET%2001%20Server%20Testing%20Contest HTTP/1.1 GET/ HTTP/1.1 GET /login.php HTTP/1.1 GET /css/bootstrap.min.css HTTP/1.1 GET /css/font-awesome.min.css HTTP/1.1 GET /cssormalize.css HTTP/1.1 GET /css/style.css HTTP/1.1 GET /js/vendor/modernizr-2.8.3.min.js HTTP/1.1 GET /css/main.css HTTP/1.1 GET /js/vendor/jquery-1.12.0.min.js HTTP/1.1 GET /bootstrap-3.3.7/js/bootstrap.min.js HTTP/1.1 GET /fonts/fontawesome-webfont.woff2?v=4.6.3 HTTP/1.1 GET/ HTTP/1.1 GET /contestproblem.php?name=RUET%2001%20Server%20Testing%20Contest HTTP/1.1 GET /logout.php HTTP/1.1 GET /login.php HTTP/1.1 POST /process.php HTTP/1.1 GET /login.php?value=fail HTTP/1.1 POST /process.php HTTP/1.1 200 302 200 200 200 200 200 200 200 302 200 200 200 302 200 302 200 200 302 200 200 200 200 200 200 200 200 200 200 200 200 302 200 302 200 302
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started