Support reading gzip-compressed log files (e.g. from logrotate) #526
alexxgarci
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Problem
Right now log-viewer only reads plain-text log files. In most production setups,
logrotatehandles rotation of Laravel's logs, and its default config (compress, often withdelaycompress) gzips rotated files after one cycle — e.g.laravel-2026-06-20.log.gz. Once that happens, those files disappear from log-viewer's file list (or error out if pointed to directly viainclude_paths, per #138), even though every browser and OS already handles gzip natively.This means anyone using logrotate loses visibility into log history older than a day or two — right when you need it most during an incident.
Proposed solution
PHP has gzip support built in, no new dependencies needed:
.gzfiles during log discovery and list them alongside regular logs.zlibstream wrapper (compress.zlib://path.gz) orgzopen()/gzgets(), decompressing on the fly — the parsing/formatting layer wouldn'''t need to change since it still just sees plain-text lines..gzis probably simplest, since browsers decompress on save/open anyway.The part I expect is genuinely tricky:
IndexedLogReaderlooks like it relies on seeking within the file for fast pagination, and gzip streams aren'''t seekable the same way. Compressed files would likely need a different strategy — sequential read with a byte-offset index built once, or a simpler non-indexed fallback path just for.gz.Why this matters
logrotate + gzip is one of the most common rotation setups out there. I suspect other users are hitting the "my old logs vanished" issue (see #138) without realizing rotation/compression is the cause.
Happy to help test or send a PR if you can point me at the intended approach for the reader layer — wanted to check before diving in given the indexing complexity above.
All reactions