Skip to content
This repository has been archived by the owner on Feb 8, 2022. It is now read-only.
/ http-logs Public archive

Simple program that reads a log file and displays statistics

License

Notifications You must be signed in to change notification settings

jeremyhalin/http-logs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

http-logs

Simple program that reads a log file (w3c-formatted HTTP access log) and displays statistics.

How to use ?

Prerequisites

You will need to have Node.js installed.

  1. clone this repo to the folder of your choice
  2. go to the folder where you cloned the repo and execute npm install
  3. open a terminal and run the command below

Run program

node watch-logs --path=/path/to/log/file.log --time=10000 --limit=5

Optional arguments

path: relative or absolute path to file (default to /tmp/access.log).

time: time in milliseconds to wait between two reads of the file (default to 10000 milliseconds).

limit: limit of sections of the website to display (default to 5).

Possible improvements

  • show most visited webpages (not only section)
  • show most recurrent IPs
  • detect DDoS attack ?
  • create notifications based on events (e.g. send an email or SMS if error rates go beyond 10%)
  • save data to database to keep history
  • display charts over time
  • use ESLint on project
  • implement tests

Difficulties

  • I didn't know how to keep reading a file as it's modified in Node.js
  • I had to create a fake realtime log file to test my code
  • I had to find the correct regex to be able to read and split data for each access log line

About

Simple program that reads a log file and displays statistics

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published