Marginally Interesting
logexplain

logexplain

Github repo: https://github.com/mikiobraun/lx

Install: go install github.com/mikiobraun/lx@latest

What it is: Using an LLM to explain a log stream.

When I was recently playing around with ollama to test out some local models and the effect of context sizes, I got a bit tired of parsing the (relatively) detailed ollama logs to figure out if the changes have made it, or if I accidentally misspelled an environment variable again. Naturally I thought "maybe AI can solve this for me?"

My idea was something like: collect a bunch of log-lines, maybe maximum number, time since last run, send them to an LLM with a prompt. My reasoning was that either the LLM knows the format, or the prompt would contain an explanation of the prompt. A quick search showed the logwhisperer as a similar project but following my credo "the best way to learn something is to do it yourself" I started designing with Claude Code and created lx - logexplain.

Running that on ollama logs, restarting and then having llama3.2:1b parse a bit of text (I was testing on a raspberry pi 5!), you get this:

# You need to set OPENAI_BASE_URL, OPENAI_MODEL, and potentially OPENAI_API_KEY
$ journalctl -fu ollama -n 0 | lx --profile ollama
[22:19:41] Ollama service stopped then restarted; config logged, two GPU‑probe runners launched, CPU compute detected, low‑VRAM mode entered.
[22:19:50] Loaded Llama 3.2 1B Instruct (1.22 GiB), CPU‑only (0 offload, 1.3 GiB req), runner started in 1.78 s, 1 runner loaded
[22:19:57] /api/generate returned 200 in 10.8 seconds.

Great improvements! :)

You can also add a --focus option to look for specific types, for example "show only which [GIN] endpoints are being called" you get

[22:22:32] HEAD '/' and POST '/api/show' called, both returned 200.
[22:22:37] POST '/api/generate' returned 200 in 7.6 s.

The examples above were using gpt-oss:120b in the cloud. But this actually worked interestingly well with local models. Even a gpt-oss:20b produced good results which I could even run on my MacBook Pro M1 Max with 32GB. Adding the --debug flag also shows some timings:

lx: debug: summary of 13 lines: 6.57s total, 3.87s to first token, prompt 3424 tok @ 884 uncached tok/s, completion 162 tok @ 60 tok/s
[22:24:31] Restarted ollama service, loaded config, scanned blobs, no GPUs found – CPU only, low‑VRAM mode entered.
lx: debug: summary of 189 lines: 18.09s total, 13.05s to first token, prompt 10352 tok @ 793 uncached tok/s, completion 267 tok @ 53 tok/s
[22:24:58] POST /api/show caused Llama 3.2 1B Instruct to load into 1.3 GiB CPU memory, runner ready in 1.03 s.
lx: debug: summary of 1 lines: 5.75s total, 2.76s to first token, prompt 2450 tok @ 888 uncached tok/s, completion 186 tok @ 62 tok/s
[22:25:04] Generate completed 200 in 10.08 s using Llama 3.2 1B Instruct.

About 800 t/s prefill, and then 60 t/s is not too bad, although you start moving away from real-time considerably. But at least you don't pay per token!

React to this post

Back to all posts