An internal python reporting tool to analyze server data from a PosgreSQL database.
This python script tool will connect to and read from the provided news database, in order to analyze user activiy by answering three questions:
- What are the three articles with the most views?
- Who are the three authors with the most overall views?
- On Which days days did user requests lead to more than 1% errors?
- python 2.7.12 - Or later version
- VirtualBox - A cross-platform virtualization software
- Vagrant - A tool for working with virtual environments
- git - A version control tool
- Install Vagrant.
- Install VirtualBox.
- Clone this repository with the needed VirtualBox configuration.
$ git clone https://github.com/udacity/fullstack-nanodegree-vm
- cd into the vagrant reposiotry.
$ cd fullstack-nanodegree-vm/vagrant/
- Clone this reposiotry with the database and python script into the vagrant directory.
$ git clone https://github.com/neagkv/Logs_Analysis.git
- Start up the virtual machine. Note this may take several minutes.
$ vagrant up
- log into the virtual machine.
$ vagrant ssh
- cd into the Logs_Analysis directory.
$ cd /vagrant/Logs_Analysis
- Unzip the database.
$ unzip newsdata.zip
- Load data.
$ psql -d news -f newsdata.sql
- Connect to database.
$ psql -d news
- Create first view.
news=> create view all_requests as select date_trunc('day', time) "day", count(*) as good from log group by day order by day;
- Create second view.
news=> create view error_requests as select date_trunc('day', time) "day", count(*) as bad from log where status != '200 OK' group by day order by day;
- Run file with python
$ python logs_report.py
- compare output with output.txt