These are the projects for the JavaScript Level 2 module in Learn JS the Hard Way.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
js-level-2-projects/02-filter-a-log-file
Zed A. Shaw 593b120be5 Break out the reporting from the parsing so I can parse the files on all my servers in a cron job, but collect them and report on a central server. 2 years ago
..
README.md More explanation of all the projects in the README files. 2 years ago
chains_parser.js Break out the reporting from the parsing so I can parse the files on all my servers in a cron job, but collect them and report on a central server. 2 years ago
chains_parser_incremental.js A possible implementation of an incremental analyzer that can take previous results and add more. Not sure if it's good yet. 2 years ago
chains_reporter.js Break out the reporting from the parsing so I can parse the files on all my servers in a cron job, but collect them and report on a central server. 2 years ago
package-lock.json Actually now it removes the list version and only doing sets, then it can glob many files to produce results. 2 years ago
package.json Actually now it removes the list version and only doing sets, then it can glob many files to produce results. 2 years ago
short.log.txt First layout of Ex02 but no code quite yet. 2 years ago
step1.js Got the two starters down. 2 years ago
step2.js Got the two starters down. 2 years ago

README.md

02: Filter a Log File

In this exercise you'll take a webserver log I've created and parse the log file then filter the log for special events or information. You have a couple of approaches:

  1. Brute force the filter by simply using a regex to scan the raw text.
  2. Parse each line into meaningful data and filter on that.

The two samples in this directory get you started with both approaches. The step1.js file starts off the brute force RegEx method while the step2.js starts off the parsing method.

Keep in mind these are not solutions. They're starter file so you can get going without having to struggle with all of the setup. Once you're done you should attempt this again but do it entirely from nothing so you know how that's done.

Learning Objectives

As with all of these exercises you're not really learning about the parsing log files. Your actual goal is:

  1. Learn how a RegExp works.
  2. Learn how to do more than just simple regular expression matching lines. This would be a next level challenge.

A small side adventure is how to load and process text files, but you should have learned that from Ex 01.