Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Log Analyzer

A web dashboard for analyzing server log files. Parses logs, handles messy real-world formats gracefully, and presents useful stats — error rates, slowest endpoints, top IPs, request timelines — in a clean browser UI.


Requirements

  • Node.js v18 or higher
  • npm (comes with Node.js)

Install

git clone <your-repo-url>
cd log-analyzer
npm install

Generate a sample log file

A log generator script is included. Run it before starting the server if you don't have a log file handy:

node scripts/generate-logs.js
# writes 5000 lines → sample.log

node scripts/generate-logs.js 20000 big.log
# custom line count and output path

Run

node src/server.js --log sample.log

Then open your browser at http://localhost:3000

The dashboard loads automatically once the file is parsed. For large files (100k+ lines) this takes a few seconds — the loading screen will show until it's ready.

Custom port

PORT=8080 node src/server.js --log sample.log

Dashboard panels

Panel What it shows
Summary bar Total requests, error count, error rate, avg/p95 response time, skipped lines
Requests over time Line chart bucketed by minute or hour depending on log span
Status codes Doughnut chart — 2xx / 3xx / 4xx / 5xx breakdown
HTTP methods Bar chart — GET / POST / PUT / DELETE counts
Slowest endpoints Top 10 by average response time with p95, max, and error count
Top IPs Top 10 IPs by request volume with per-IP error rates
Format anomalies Every skipped line with its line number and reason

What the tool handles

  • ISO 8601 timestamps (2024-03-15T14:23:01Z)
  • Slash-format timestamps (2024/03/15 14:23:01)
  • Named-month timestamps (15-Mar-2024 14:23:01)
  • Unix epoch timestamps (1710512581)
  • Response times in ms, seconds, or bare numbers
  • Missing or placeholder (-) status codes
  • Extra fields (user agents, referrers) appended to lines
  • JSON-formatted log lines mixed in
  • Indented lines, blank lines, stack traces, and corrupt partial writes
  • Files of any size (streamed line by line, never fully loaded into memory)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages