Coder Social home page Coder Social logo

logs_analysis's Introduction

#Logs-Analysis Project

Project Overview

In this project , am running some queries on Python DB API to generate reports about three main questions :

1. What are the most popular three articles of all time?
2. Who are the most popular article authors of all time?
3. On which days did more than 1% of requests lead to errors?

How to Run?

PreRequisites:

Setup Project:

  1. Install Vagrant and VirtualBox
  2. Download or Clone fullstack-nanodegree-vm repository.
  3. Download the data from here and copy to local folder.
  4. Unzip this file after downloading it. The file inside is called newsdata.sql.

Launching the Virtual Machine:

  1. Launch the Vagrant VM inside Vagrant sub-directory in the downloaded fullstack-nanodegree-vm repository using command:
  $ vagrant up
  1. Then Log into this using command:
  $ vagrant ssh
  1. Change directory to /vagrant and look around with ls.

Setting up the database and Creating Views:

  1. Load the data in local database using the command:
  • psql -d news -f newsdata.sql

The database includes three tables:

  • Authors
  • Articles
  • Log
  1. Start psql by using > psql and then hit Enter.

  2. Use \c news to connect to database.

  3. 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

Running the queries:

  1. From the vagrant directory inside the virtual machine
  2. cd LogsApp
  3. $ python Logs.py

logs_analysis's People

Watchers

 avatar  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.