This is my Logs Analysis project for Udacity's Full Stack Developer Nanodegree.
It is a Python script using psycopg2 to run queries on a mock PostgreSQL database for a fictional news website.
It generates a console output for three reports:
- Top 3 articles, most viewed first.
- Most popular authors, most viewed first.
- Days above 1% request errors
| Column | Type |
|---|---|
| name | text |
| bio | text |
| id | integer |
Primary key:
- id
| Column | Type |
|---|---|
| author | integer |
| title | text |
| slug | text |
| lead | text |
| body | text |
| time | timestamp with time zone |
| id | integer |
Primary key:
- id
Foreign-key:
- author REFERENCES authors(id)
| Column | Type |
|---|---|
| path | text |
| ip | inet |
| method | text |
| status | text |
| time | timestamp with time zone |
| id | integer |
Primary key:
- id
- Installed VirtualBox
- Installed Vagrant
- Downloaded VM from Udacity
- Downloaded DB for
newsdatabase (newsdata.sql)
- Unzup and copy the
newsdata.sqlfile fromnewsdata.zipto your vagrant directory - Start the VM using your console in the downloaded Vagrant VM's directory using
vagrant up - SSH into your VM using
vagrant ssh - To load the data,
cdinto thevagrantdirectory and use the commandpsql -d news -f newsdata.sql
- Create a new directory in vagrant's shared directory (i.e.:
../vagrant/logs_analysis/) - Clone the repository and put it into the previously created directory. (i.e.:
../vagrant/logs_analysis/)
- SSH into your VM using
vagrant ssh cdinto the created folder (i.e.:/vagrant/logs_analysis)- Run
./reporting.py
An example of the output can be seen in output_example.txt
Copyright (c) 2017 Péter Szabó. All rights reserved.
This work is licensed under the terms of the MIT license.
For a copy, see https://opensource.org/licenses/MIT.