In this project I was tasked to create a reporting tool which can print reports based on real world web-application data, with fields representing informaton that a webserver would record, such as status codes and URL paths. This reporting tool is use Python program using psycopg2
module to connect the database.
$ vagrant up
$ vagrant ssh
This section will describe the SQL views I created for the code to function properly and how to run the program.
This program uses three SQL views.
For Problem 3:
CREATE VIEW BRQSTS AS SELECT time::timestamp::date, COUNT (*) as wrqsts FROM log WHERE status LIKE '404 NOT FOUND' GROUP BY time::timestamp::date ORDER BY time ASC;
CREATE VIEW timerqsts AS SELECT time::timestamp::date, COUNT (*) as requests FROM log GROUP BY time::timestamp::date;
CREATE VIEW error_view AS SELECT timerqsts.time, (cast(BRQSTS.wrqsts as float)/cast(timerqsts.requests as float))*100 AS error FROM BRQSTS JOIN timerqsts on BRQSTS.time = timerqsts.time ORDER BY error;
$ python3 log-analysis.py