larzlogtail
Read only what a log file gained since last time.
Ported from a real production error watcher: a persisted byte offset means an hourly error-scan cron reads only the new bytes, not the whole log again every run. Uses tail -c +N under the hood, since Larzscript has no low-level file-seek builtin. If the file is smaller than the saved offset (rotated or truncated), it transparently starts over from the top instead of erroring.
larzscript pkg install logtail
What you get
- Persisted byte offset - no re-scanning old lines
- Auto-resets on rotation/truncation
- grep_new() filters by substring patterns
- Plain read_new()/read_new_lines() for anything else
Try it
import "logtail" as logtail
write_file("/tmp/demo.log", "2026-01-01 INFO boot\n")
logtail.read_new_lines("/tmp/demo_logtail.state", "/tmp/demo.log")
append_file("/tmp/demo.log", "2026-01-01 ERROR disk full\n2026-01-01 INFO ok\n")
let errs = logtail.grep_new("/tmp/demo_logtail.state", "/tmp/demo.log", ["ERROR"])
print(errs)Output
[2026-01-01 ERROR disk full]
Why it's in the Larz Stack
larzlogtail is a real Larzscript package (larzscript pkg install logtail) - money-native, zero dependencies, the same language as the rest of the estate, not a separate Python runtime. It composes with the rest of the Larz Stack and the Larz framework.