#Logs-Analysis Project
In this project , am running some queries on Python DB API to generate reports about three main questions :
- Install Vagrant and VirtualBox
- Download or Clone fullstack-nanodegree-vm repository.
- Download the data from here and copy to local folder.
- Unzip this file after downloading it. The file inside is called newsdata.sql.
- Launch the Vagrant VM inside Vagrant sub-directory in the downloaded fullstack-nanodegree-vm repository using command:
$ vagrant up
- Then Log into this using command:
$ vagrant ssh
- Change directory to /vagrant and look around with ls.
- Load the data in local database using the command:
psql -d news -f newsdata.sql
The database includes three tables:
- Authors
- Articles
- Log
-
Start psql by using
> psql
and then hit Enter. -
Use
\c news
to connect to database. -
You'll need to create a view by running following script:
CREATE view articleView as
Select ar.title , ar.slug , count(path) as Views , ar.author from log
Join articles ar
ON log.path like concat('%' , ar.slug)
Group by ar.title , ar.slug , ar.author
Order by count(path) desc
- From the vagrant directory inside the virtual machine
cd LogsApp
$ python Logs.py