GithubHelp home page GithubHelp logo

foxlog's Introduction

foxlog

Description

Foxlog is a simple console application that monitor a w3c-formatted HTTP access log. It will display on the screen the most visited section of the website, the total number of hits and the total number of bytes transferred during the last 10 seconds.

Foxlog manages an alert system that tracks whenever the average hit per second exceed a threshold during the last 2 minutes. The history of alerts will stay on screen until the app is closed.

Getting Started

To run the app use :

yarn start
# or
node ./src/main.js

By default, the app will monitor the /tmp/access.log but it can be overridden by the first command line argument.

By default, the app has a hit per second threshold of 10 hits per second but it can be overridden by the second command line argument.

You must specify the monitored file path if you want to change the hit per second threshold.

You can pass a third argument to the app. If this argument is true, a fake w3c-formatted HTTP access log generator will write to the monitored file path.

# Example 1
yarn start /path/to/my/log/file.log 12
# Example 2
node ./src/main.js /tmp/mylog.log 9 true

You can use the dockerfile to build a docker image that will behave exactly like the app.

Architecture

The app is divided into 3 pieces :

  • The parsers
  • The logics
  • The loggers

The parser modules are responsible for extracting all the data of the w3c-formatted HTTP access logs.

The logic modules represent all the logic of the app, there is a module that represents and handles hits (hit.js), a module that analyses a list of hits (synthesis.js), and a module that manages the alerts (alert-manager.js).

The logger modules are responsible for mapping the output of logic functions to logging string that will be displayed to the screen.

Tests

To run the tests :

yarn test

Suggested improvement

For the moment, foxlog does not handle the time zone of dates of the log (09/May/2018:16:00:39 +0000).

Adding a better way to manage the console line arguments and adding a help section (-h).

Adding more statistics.

foxlog's People

Contributors

dependabot[bot] avatar jeanbaptisteassouad avatar

Watchers

 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.