Reducing wear level of sd card by storing openhab log files in memory

Hi there!

I’m wondering if it is possibly (and how) to have my openhabian installation store it’s log file in memoy instead of on sd card. I’m asking this because I suspect strange errors due to defect / laggy sd cards.

I think that I’m not the only one using openhabian, so I wonder why this isn’t offered as a default :wink:

Best regards,

Good point. I don’t use openHABian, but I don’t see why you couldn’t you create a ram drive and then edit your org.ops4j.pax.logging.cfg file to put the logs into it. Downside would be that the logs would be wiped after a reboot, unless you archived them off somewhere. Odd timing, because I posted this earlier today…

Thanks, I’ll have a look. I’m aware of the downsides – maybe something like an USB stick could be an alternative!

Thank you, Skinah! Looks like a fool-proof tutorial, I’ll check it out!

Here’s another option… set the immediateFlush setting for your appenders to false. You won’t be able to view log entries real-time, but it caches log entries until there is enough of them to fill a buffer (less writes). For example…

log4j2.appender.event.immediateFlush = false

Thanks for the other alternative. But I think I stick to a RAM fs or USB stick for the logs, since at the moment I often work with active logviewers to debug my rule development.

1 Like