314_PIE wrote:Im confused about this size=4096M, i assume its the amount of virtual ram as my Pi Zero is 512mb.
Maybe my options weren't optimal as example. It was from my main pc and not the Rpi. That's why i have a size of 4096MB.
314_PIE wrote:The tutorial you wrote up awhile back, was this your own or was it from a tutorial blog, i felt like i need more info during each step for /var/log. and how can i add this transientlog.service through SSH remotely?
I wrote this tutorial myself after many try and error attempts from the internet. The "transientlog.sh" script is based on another script from the internet but i changed it heavily because the original script didn'tt work like i wanted.
To use it over SSH you just have to transfer the transientlog.sh script and transientlog.service file with help of SCP to the Rpi. Then you can activate it like i described. Alternatively if you don't need the old logs after a reboot you can just add a tmpfs to /var/log and that's all.
314_PIE wrote:So by my understanding, these scripts store /var/log into ramdisk, when the pi does a shutdown, the logs writes to primary disk once every shutdown to prevent the log files from disappering at bootup. So when the uptime is over a month, depending on the limit size stored in tmpfs, does the pi automatically reboots to refresh the ramdisk when it reaches its size limit?
Yes /var/log is stored in a ramdisk when running. At shutdown or user specific intervals (via crontab) the content is stored on the sd-card to back up the files for a reboot or crash. At bootup the ramdisk is filled with the backed up files so the log files start again where they stopped.
For the size limit within /var/log i use "logrotate" to rotate and gzip old logs after some time and they also get deleted when they are older than an predefined amount of time. With help of this the content of all log files doesn't grow larger at some point in time. For my Rpi i only got ~5MB in /var/log over many months since i use this setup. So i don't ave a problem with an ever growing log directory.