-- Leo's gemini proxy
-- Connecting to gemini.ctrl-c.club:1965...
-- Connected
-- Sending request
-- Meta line: 20 text/gemini
I am a big fan of log files. As I develop and test, and deploy code, logs provide invaluable information for debugging and improving (and sometimes, understanding) the system.
While watching logs with 'tail -f' works pretty well, I would _really_ like to see a heat-mapped view of a log. By that I mean colorized lines which start hot and slowly cool -- allowing me to instantly see if anything happened recently, as well as the relative age of entries -- at a glance!
I assumed that anything I can think someone has already done -- the world is now big enough for that. But it appears that no one has, in this case. There are many ways to colorize a log based on its content, but not time-based.
If you know of something like that, please email stack@ctrl-c.club.
My crocodile brain started coding before I even finished the first search... It's an interesting problem (as I get older I find all problems interesting)... There are some curious edge cases that can really screw you:
A log may be rotated or wiped, so caching state (required for color-mapping against time) is tricky;
A log may not be a log - something can write random data in the middle!
A line may not be finished writing when sampled!
I need to correllate between reads to age older lines - kind of an interesting sliding window problem...
I need to either be notified of file changes or sample file size efficiently enough.
So I could read the tail -n- bytes into a buffer and scan backwards for line ends, entering them into an index (along with a timestamp). Later, if a change is detected (say, filesize changed), I can re-read, and scan again, but in a more complicated way, against the old index:
New data is just scanned with new timestamp;
Old data must match the index, timestamp copied;
Mismatch indicates a log rotation; dump old data;
Except a mismatch in the final line-end of old log may mean a partially-written line and is not an error.
A redisplay task should assign colors based on age, and reprint the required lines. This should be configurable...
Configuration: parameters (ugh), mapping strategy, adjusting time and color at runtime, etc.
Maybe worth a few days of coding, since I have nothing better to do. I want to say a day, but I know better.
=>. index
=>.. home
-- Response ended
-- Page fetched on Fri Jun 14 01:40:43 2024