Git Product home page Git Product logo

logs_analysis's Introduction

Logs_Analysis

An internal python reporting tool to analyze server data from a PosgreSQL database.

Overview:

This python script tool will connect to and read from the provided news database, in order to analyze user activiy by answering three questions:

  1. What are the three articles with the most views?
  2. Who are the three authors with the most overall views?
  3. On Which days days did user requests lead to more than 1% errors?

Requirements:

  • 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

Setup and configuration:

  1. Install Vagrant.
  2. Install VirtualBox.
  3. Clone this repository with the needed VirtualBox configuration.
$ git clone https://github.com/udacity/fullstack-nanodegree-vm
  1. cd into the vagrant reposiotry.
$ cd fullstack-nanodegree-vm/vagrant/
  1. Clone this reposiotry with the database and python script into the vagrant directory.
$ git clone https://github.com/neagkv/Logs_Analysis.git
  1. Start up the virtual machine. Note this may take several minutes.
$ vagrant up
  1. log into the virtual machine.

$ vagrant ssh
  1. cd into the Logs_Analysis directory.
$ cd /vagrant/Logs_Analysis
  1. Unzip the database.
$ unzip newsdata.zip
  1. Load data.
$ psql -d news -f newsdata.sql

Connect to database and create views:

  1. Connect to database.
$ psql -d news
  1. 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;
  1. 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;

To run the script:

  1. Run file with python
$ python logs_report.py
  1. compare output with output.txt

logs_analysis's People

Contributors

neagkv avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.