/log-file-parsing

Primary LanguageRubyOtherNOASSERTION

Log File Parser

You work at a devops company, and you need to parse log files.

You get log files that are in this format:

W, [2014-05-10T13:49:19.049260 #83516]  WARN -- : deliver B2C systems
W, [2014-05-10T13:49:19.049408 #83516]  WARN -- : transition sticky bandwidth

That is...

[log level char], [<date> #<processid>]  <log level> -- : <message>

Logic

You need to write code that can parse these logs and be able answer questions like:

  • What are all the dates the log covers
  • How many log messages were added on a given date
  • How many log messages were there of each type (DEBUG / WARN etc...)

File IO

In your bin directory, write some code that reads the data/log.log file and passes it into your class, then prints the results of the various reports to STDOUT.

Setup

  • Fork
  • Clone
  • Turn on TravisCI for the fork by visiting https://travis-ci.org/profile/, clicking the "Sync now" button and scrolling down to find the repository to build.
  • Create a new branch for your work using git checkout -b v1
  • Implement specs and code
  • Push using git push -u origin v1

Further Practice

This warmup can be completed multiple times to increase your comfort level with the material. To work on this from scratch, you can:

  1. Add an upstream remote that points to the original repo git remote add upstream git@github.com:gSchool/log-file-parsing.git
  2. Fetch the latest from the upstream remote using git fetch upstream
  3. Create a new branch from the master branch of the upstream remote git checkout -b v2 upstream/master
  4. Implement specs and code
  5. Push using git push -u origin v2

Each time you do the exercise, create a new branch. For example the 3rd time you do the exercise the branch name will be v3 instead of v2.