Skip to content

Jpeg-create/logpulse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

logpulse

logpulse is a small command-line tool for watching Nginx access logs in real time.

Point it at a log file and it gives you a live view of request rates, error counts, busiest endpoints, and response times right in your terminal.

I built it in Go because I wanted something fast, portable, and easy to run on any server.

Go License


Why I built this

Sometimes you just want to SSH into a server and quickly understand what's happening.

Tools like Splunk and Datadog are powerful, but they can be overkill when all you need is a quick look at traffic and errors. On the other hand, tail -f shows raw logs but doesn't tell you much at a glance.

logpulse sits in the middle. It's lightweight, requires no setup, and runs entirely in your terminal.


Features

  • Watches a log file and processes new lines as they are written
  • Shows requests per second, error rates, and average response times
  • Tracks the top 5 most requested endpoints
  • Groups errors by status code
  • Displays an alert banner when errors exceed your threshold
  • Works with Nginx Common Log Format

Installation

You need Go 1.20 or later.

git clone https://github.com/Jpeg-create/logpulse.git
cd logpulse
go build -o logpulse main.go parser.go tailer.go stats.go models.go dashboard.go cli.go
sudo mv logpulse /usr/local/bin/

Usage

Start monitoring a log file:

logpulse --file /var/log/nginx/access.log

With additional options:

logpulse --file /var/log/nginx/access.log --alert-threshold 10 --errors-only

Flags

Flag Default Description
--file sample.log Path to the log file to monitor
--alert-threshold 5 Number of errors that triggers the alert banner
--errors-only false Only process requests with error status codes

Press q to quit.


Supported Log Format

logpulse parses the standard Nginx Common Log Format:

192.168.1.1 - - [11/May/2026:13:45:01 +0000] "GET /api/users HTTP/1.1" 200 45

This is the default format used by Nginx and Apache, so it should work out of the box for most setups.


Project Structure

logpulse/
  main.go       # Application entry point
  models.go     # Data structures (LogEntry, Stats, etc.)
  parser.go     # Converts raw log lines into structs
  tailer.go     # Watches files for new log entries
  stats.go      # Aggregates metrics in a sliding window
  dashboard.go  # Terminal UI using Bubble Tea and Lip Gloss
  cli.go        # Command-line flags

How It Works

The file watcher runs in a goroutine and sends new lines into a channel the moment they appear. The main goroutine sits on the other end of that channel, parses each line, updates the stats, and redraws the dashboard in place.

This is the part where Go genuinely shines. The watcher and the dashboard run concurrently without blocking each other, which is why the updates feel instant. No polling delay, no setup required, just a live view that stays in one spot.


Built With


License

MIT

About

Real-time log analytics engine built in Go

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages