Skip to content

About

Experimental live dashboard and API for monitoring llama.cpp server completions from streamed command-line logs.

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

llama-tracker

Experimental live dashboard and API for watching llama.cpp server completions from streamed logs.

llama-tracker sits beside a command-line llama.cpp server process, reads the logs that normally go to stdout/stderr, and turns the useful parts into a live browser view and JSON/SSE API. It is intended for running on the same Linux server as llama.cpp, then viewing completion status from another PC on the network.

Experimental Status

This project is an experiment.

It currently parses the human-readable llama.cpp server log stream with regular expressions. That makes it lightweight and easy to run, but also means it can break if llama.cpp changes its log wording. Treat this as a practical prototype for observability, not a stable monitoring product.

What It Shows

The tracker currently extracts:

  • active completions by slot id and task id
  • prompt processing status and progress
  • prompt token count, current token count, final token count, and truncation status
  • generation status from sampler and reasoning-budget log lines
  • prompt/eval/total timing and tokens per second
  • completed and cancelled tasks
  • prompt cache size and limits
  • checkpoint creation/restoration counts
  • recent HTTP request completion lines
  • the latest raw log line for debugging

Dashboard Screenshots

The dashboard brings server, model, and live hardware details together so you can verify the tracked llama.cpp instance at a glance.

Server, model, runtime, and live host metrics

Recent completions show progress, throughput, checkpoint use, and estimated costs in one table, including completed and cancelled requests.

Recent completion activity and cost summary

Expanding a completion exposes its timing breakdown, MTP acceptance, token counts, cost estimates, and the matching raw llama.cpp log lines.

Expanded completion details

How It Works

llama-tracker can read logs in two ways:

  • tail an existing log file
  • read streamed log lines from stdin

It then exposes:

  • GET / - web dashboard
  • GET /api/state - current JSON snapshot
  • GET /api/events - Server-Sent Events stream for live clients
  • GET /widget.js - browser widget script used by the dashboard

The implementation uses only Python standard library modules.

Requirements

  • Linux
  • Python 3.10 or newer
  • llama.cpp server output that includes slot/task timing logs

No Python package installation is required.

Quick Start

Run the tracker against the included sample log:

python3 -m llama_tracker.server logs.txt --host 0.0.0.0 --port 8765

Open the dashboard from another machine:

http://SERVER_IP:8765/

Replace SERVER_IP with the Linux server's address.

Run With llama.cpp

Add -lv 4 to your llama-server command so its logs include the verbose slot/task detail this app parses.

The easiest option is the launcher script. Put your normal llama-server command after --:

scripts/run-llama-tracked.sh --host 0.0.0.0 --port 8765 -- \
  ./llama-server -m /models/model.gguf --host 0.0.0.0 --port 8080

The script:

  • starts the tracker web server
  • runs your llama.cpp command
  • keeps the llama.cpp output visible in the terminal
  • streams that same output to the tracker in real time
  • prints the dashboard URL

To keep a raw copy of the logs as well:

scripts/run-llama-tracked.sh --log-copy ./llama-server.log -- \
  ./llama-server -m /models/model.gguf --host 0.0.0.0 --port 8080

You can also pipe output directly into the tracker:

./llama-server -m /models/model.gguf --host 0.0.0.0 --port 8080 2>&1 \
  | python3 -m llama_tracker.server - --host 0.0.0.0 --port 8765

Track An Existing Log File

If llama.cpp already writes to a file:

python3 -m llama_tracker.server /path/to/llama-server.log --host 0.0.0.0 --port 8765

Always-on monitor

For a llama.cpp server that is started independently (for example by tmux or systemd), send its output to a stable file and start the monitor separately:

./llama-server -lv 4 -m /models/model.gguf ... >> /var/log/llama-server.log 2>&1
scripts/run-monitor-only.sh --log-file /var/log/llama-server.log --host 127.0.0.1

run-monitor-only.sh does not start llama.cpp. It can be started before the log exists, stays running while llama.cpp is restarted, and follows log rotation or truncation. To keep it running after boot, run that command from a service manager such as systemd. A tracker cannot safely attach to the stdout pipe of an already-running process; configure the llama.cpp service to write to this log file (or use run-llama-tracked.sh when the tracker starts it).

For a one-shot parse of the current file without waiting for new lines:

python3 -m llama_tracker.server /path/to/llama-server.log --no-follow

API

Current state:

curl http://SERVER_IP:8765/api/state

Live event stream:

curl http://SERVER_IP:8765/api/events

The /api/state response includes active tasks, recent completed tasks, slots, recent requests, cache state, counters, and the last parsed line.

MCP And Widget Ideas

The HTTP API is deliberately simple so other clients can sit on top of it.

A future MCP adapter could expose read-only tools such as:

  • get_llama_state
  • list_llama_completions
  • get_llama_completion(task_id)

A browser widget can either poll /api/state or subscribe to /api/events and refresh when updates arrive.

Security Notes

By default, examples bind to 0.0.0.0 so a client PC can reach the dashboard. Only do that on a trusted network.

This experiment does not currently include authentication, TLS, persistence, or access control. Put it behind a reverse proxy or firewall if running outside a private development environment.

Development

Compile-check the Python files:

python3 -m py_compile llama_tracker/parser.py llama_tracker/server.py

Check the launcher script syntax:

bash -n scripts/run-llama-tracked.sh

License

MIT. See LICENSE.

About

Experimental live dashboard and API for monitoring llama.cpp server completions from streamed command-line logs.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages