Git Product home page Git Product logo

log-analysis's Introduction

Full Stack Web Developer Nano-Degree

Project (1): Log Analysis

This is the first project in Full Stack Web Developer Nano-Degree. It shows a report about viewing articles of authors.

main.py file is a python file implements three queries:

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

It contains a view to help implementing the first two queries:

CREATE OR REPLACE VIEW logArticlesView AS
            SELECT a.title, COUNT(l.path) AS views, a.author
            FROM log AS l, articles AS a
            WHERE substr(l.path, 10) = a.slug
            GROUP BY a.author, a.title;

Since the keyword REPLACE will check the existing of the view, no need to omit that query before run code for multiple times.

The output of this code is in output.txt file.

Setup

1. Start with Software Installation

- You will also need a Unix-style terminal program. On Mac or Linux systems, you can use the built-in Terminal. On Windows, we recommend Git Bash, which is installed with the Git version control software.

Once you get the above software installed, follow the following instructions:

cd vagrant
vagrant up
vagrant ssh
cd /vagrant
mkdir log-analysis-pr

- For this project, all the work will be on your Linux machine, so always make sure you logged in by using the following commands: vagrant up, then vagrant ssh, then cd /vagrant. Note: Files in the VM's /vagrant directory are shared with the vagrant folder on your computer. But other data inside the VM is not.

2. Download and Load the Data
  • For this project, you need to download newsdata.sql from the project page or by clicking on the following link: https://d17h27t6h515a5.cloudfront.net/topher/2016/August/57b5f748_newsdata/newsdata.zip
  • Move the newsdata.sql to your project folder log-analysis-project
  • Load the data from the newsdata.sql by using the following command: Note that we are using PostgreSQL for this project:
    psql -d news -f newsdata.sql
    
  • Once you have the data loaded into your database, connect to your database using:
    psql -d news
    

log-analysis's People

Contributors

sarahalhumud avatar

Watchers

James Cloos 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.