From Udacity:
You will analyze data from the logs of a web service to answer questions such as "What is the most popular page?" and "When was the error rate high?" using advanced SQL queries.
Supporting courses:
- Intro to Relational Databases
usage: logs-analysis [options]
Tool for analyzing news data provided by Udacity
optional arguments:
-h, --help show this help message and exit
-a, --all show answers to all analysis questions
-ta, --top3-articles show the three most popular articles of all time
-tu, --top-authors show the most popular authors of all time
-et, --error-thresh show the days where >1% of requests led to errors
Postgres views used for logs-analysis script.
CREATE VIEW requests_by_day AS
SELECT time::date AS day, count(*) AS requests
FROM log
GROUP BY day;
CREATE VIEW errors_by_day AS
SELECT time::date AS day, count(*) AS errors
FROM log
WHERE status = '404 NOT FOUND'
GROUP BY day;
- Vagrant or
postgres
andpsycopy2
- The news database and news data are installed (see Install Newsdata)
There are a number of ways to install logs-analysis
depending on your
current setup. To install from scratch:
git clone https://github.com/udacity/fullstack-nanodegree-vm.git fullstack && cd fullstack/vagrant
vagrant up
vagrant ssh
wget https://github.com/brenj/logs-analysis/blob/master/newsdata.zip?raw=true -O newsdata.zip
unzip newsdata.zip
psql -d news -f newsdata.sql
Note: newsdata.zip
from brenj/logs-analysis
contains the necessary views
to run logs-analysis
. If you are using the original newsdata.zip
data then
make sure to create the required views (see Views).
git clone https://github.com/brenj/logs-analysis.git && cd logs-analysis
./logs-analysis.py --all
This code base adheres to the PEP8 standard.
Criteria | Highest Grade Possible | Grade Recieved |
---|---|---|
Functionality | Meets Specifications | Meets Specifications |
Code Quality | Meets Specifications | Meets Specifications |
README File | Meets Specifications | Meets Specifications |