RAMLOG#1 without hourly removal - seems ok?

I’ve been confused why my java app logs into /var/log were suddenly getting truncated - thought it was tied to a log library update I’d made. In fact this was actually correct behaviour as my build is set to use Logging = RAMlog#1 - hourly refresh.
My app only logs in extreme (warning/error) circumstance and the logs themselves are rotated across three 50k files by my logging library - so I have disabled the hourly wipe on the RAM /var/logs and I’m using less than 2% of the ram disk when my log set is fully occupied - 50k * 3.
I’m going to assess the other logs created but there’s basically nothing else going in there!

you could choose log option #2 to disable to hourly log removal. Or as 3rd option you can go with full logging. Have a look to our online docs. There we describe all options briefly Log System Choices - DietPi.com Docs

1 Like

Yeah, I have considered all the available options - I like the SD card wear protection of RAM logging but I need to have a bit more persistence - might be 24 hrs before I can check the log… Also it appears that the deletion process may cause issues with log lck files resulting in corrupt files, hence my choice.

There is also log2ram option
GitHub - azlux/log2ram: ramlog like for systemd (Put log into a ram folder)

But not sure how it would work with the dietpi config stuff…maybe full logs option…then have the log2ram package to put it in compressed space in ram…it writes to the SD every 24hrs…only is lost if not rebooted or powered down correctly

Explanations: The script creates a /var/log mount point in RAM. So any writing of the log to the /var/log folder will not actually be written to disk (in this case to the SD card on a Raspberry Pi) but directly to RAM. By default, every day the CRON will synchronize the contents in RAM with the folder located on the physical disk. The script will also make this copy of RAM to disk in case of machine shutdowns (but, of course, it still won’t do it in case of power failures). This way you can avoid excessive writing on the SD card and extend its life.

Log2Ram’s script works on every Linux system. If you don’t have Systemd, you can still use Log2Ram with your own daemon manager.