busimus / cutelog

GUI for logging
MIT License
484 stars 45 forks source link

Autosave records? #31

Open csm10495 opened 1 year ago

csm10495 commented 1 year ago

Hi,

Is there a way to have cutelog autosave logs that it receives so that upon reopen, logs can come back up?

busimus commented 1 year ago

Not possible now, but that's not a bad idea.

Though I'm of the opinion that log persistence should be done by the log producer and not by the consumer. Currently this doesn't really work because JSON log formatters create incompatible output. But if I fixed that and also made it possible to pass a filename as an argument to cutelog so it would load the given log file when opened, would that be enough for your use case?

csm10495 commented 1 year ago

For me I'd want it to be the consumer. I have a few different things running at once. They would all send logs to cutelog.

Having cutelog be able to consume all the logs and then be able to in itself separate them out (already does that).. then being able to continue later would be amazing.

Otherwise I wind up having to hold onto json files from each producer and merging them or something to get the same effect.

If cutelog itself was updating a file with new consumed entries it would be perfect.

This winds up being sort of similar to something like ELK.. but much more lightweight for smaller use cases... Like a homelab.

busimus commented 1 year ago

Having cutelog be able to consume all the logs and then be able to in itself separate them out (already does that).. then being able to continue later would be amazing.

So you're using the single tab mode with multiple producers connected and you want everything to resume seamlessly after a restart? That's not as hard. Would be very tricky with multiple tabs.

If cutelog itself was updating a file with new consumed entries it would be perfect.

Yeah that's how it would work, but do you also want to specify the folder where these files would be created?

csm10495 commented 1 year ago

Yep exactly as you described. Setting a directory for it to work with (in case it needs to split or something) would be perfect.

Also have knobs to allow saving x days of logs with it auto removing older entries after it passes that line.

I'd personally probably save a couple months worth :)

csm10495 commented 1 year ago

I think this mechanism should also be able to be used to help speed up the ui. Right now if i log a bunch (like 10000 log messages) the ui becomes pretty likely to freeze up. Maybe if we only kept like 1000 logs in memory and load from disk as a user scrolls up, performance could improve.