Code Monkey home page Code Monkey logo

s3-log-analyzer's Introduction

Beachcasts/S3-Log-Analyzer

PHP project using Mezzio downloads usage logs from S3, parse them, and add them to a MySQL database. Following addition to the database, stats pages show usage data and charts with results graphically using Google Charts.

NOTE: This application currently is untested, but works. I intend to return and do that, but it's not done yet. Pull requests welcomed.

Setup Steps

Clone the Beachcasts/S3-Log-Analyzer repo from Github. In your terminal, navigate to the new directory.

Composer

Install dependencies using Composer.

composer install

Database

Create a new MySQL database by using statements in /data/schema.sql to create the database and table.

Environment

Rename .env.dist to become .env, and update as needed with your AWS account (IAM) settings.

NOTE: The bucket should be the location of the stats, not necessarily the bucket you want stats on. In AWS you will need to activate the stats for a given bucket, and inform where to store them. In my case, I store the stats in a bucket named 'stats-bucket'.

Rename /config/autoload/db.local.php.dist to become /config/autoload/db.local.php, and update as needed for your database credentials and location.

Run

At this point you should have a "working" application ready to serve. There are many ways to accomplish this. Here are some examples:

  • Using the built-in PHP server
php -S localhost:8080 -t public/
  • Upload the application to a webserver, or running locally, as with any PHP web-based application.

  • Deploy to AWS Lambda as an HTTP function

    This option can can be easily accomplished by installing Serverless, and issuing the following command to deploy to Lambda.

    Update the contents of serverless.yml by adding the bucket ARN from AWS. Replace <stats-bucket> with your bucket name. You may also need to update the AWS region.

    Also, some of the variables in .env may not be needed if deployed this way, because they are already handled by serverless.yml.

serverless deploy

NOTE: If deploying to Lambda, you will need to update the menu in /src/App/templates/layout/default.html according to the URL provided by Lambda.

s3-log-analyzer's People

Contributors

adamculp avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

adamculp

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.