Code Monkey home page Code Monkey logo

logparserproject's Introduction

LogParserProject

This is the code for third udacity project. The code allows you to use python to interface with a postgresql database. psycopg2 was the python-db API implemented in this project.

Some of the installing and setting up instructions were provided by udacity.

Downloads

The code can be downloaded from the following repo:

https://github.com/enmanuel17/LogParserProject.git

REQUIREMENTS:

Python 3 ONLY. How to get/install Python https://www.python.org/downloads/

Install the following python libraries:

The code also needs a backend server that runs the database. To accomplish that, we will need to install and run the following software on that order:

How to get/install VirtualBox

We will be using virtual box to create a virtual machine for running our server. You can download it from https://www.virtualbox.org/wiki/Download_Old_Builds_5_1, here. Install the platform package for your operating system. You do not need the extension pack or the SDK. You do not need to launch VirtualBox after installing it; Vagrant will do that.

How to get/install Vagrant

We will be using vagrant to configure the necessary packages for the server to run. Download Vagrant from https://www.vagrantup.com/downloads.html and install the version for your operating system. Once that is completed, git clone the vagrant configuration file we are going to use https://github.com/udacity/fullstack-nanodegree-vm.git cd into the clone and hange to this directory in your terminal with cd. Inside, you will find another directory called vagrant. Change directory to the vagrant. Once in there, run vagrant up. (This will take a while the OS is download, install and configured.) When vagrant up is finished running, you will get your shell prompt back. At this point, you can run vagrant ssh. Now you are in your db server.

How to get the database

Download the database data from here https://d17h27t6h515a5.cloudfront.net/topher/2016/August/57b5f748_newsdata/newsdata.zip . You can use the wget command to download zip file from within the VM. Once dowloaded, use the unzip command to extract the contents in the /vagrant directory inside the VM. The file inside is called newsdata.sql. use the command psql -d news -f newsdata.sql inside the VM to populate the database server with the database.

Views needed

Please create this view before running the code In the command from the VM run the following: psql -d news create view dates as select cast(time as date) as date from log group by cast(time as date); Then CTRL + D to exit.

How to Use:

Some of the steps might be optional if you went throught the requierments section.

  1. Open the terminal and navigate to the program files
  2. Run the command vagrant up, then vagrant ssh
  3. Go to the vagrant directory (program files)
  4. Load the database with the command psql -d news -f newsdata.sql
  5. Enter the database psql -d news and enter the SQL Views, then exist the database
  6. Run the application:
  • Typing python dbParselog.py from the linux command line.
  1. Enjoy the output results displayed on the terminal

LICENSE

MIT License

Copyright (c) 2017 Enmanuel Hernandez

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

logparserproject's People

Contributors

enmanuel17 avatar

Watchers

 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.