Skip to content
View in the app

A better way to browse. Learn more.

Armbian Community Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

How can I set log2ram never to write to the disk?

Featured Replies

Hi,

 

I'd like to setup log2ram so that it never writes to the disk, but rather discards all logs at shutdown. The documentation for log2ram says that if I delete /etc/cron.daily/log2ram it will only sync the logs to the disk at shutdown. But is there a way to have it not even do that?

 

Also, in order to prevent log2ram from filling up all its space in RAM, is it possible to setup an overwrite mechanism so that the logs begin overwriting themselves once they hit the space limit?

Check out line 3

3. If you don't need detailed archived logging. You can protect your sdcard from hourly writes by telling log2ram to not write syslog and kern.log to disk. As a bonus at boot your ramdisk will not be filling with previous session's logs.

 

on This Post

 

Not quite what you're looking for but it might give a hint?

  • Author

I see. He says to insert a clause into those lines to exclude certain files. Are you hinting that if I take out those rsync lines all together it will never sync to the disk at all (but otherwise function properly)?

 

Also, regarding RAM filling up, deleting the logs between sessions would normally do the trick, but I'm trying to prevent a situation where I'd keep a computer logged in for a long time or do something that results in lots of messages being written to the logs and the RAM disk would fill up.

Edited by Isaac

I was thinking that some of the syntax may lead you to discover your own solution.  Looks like there has been some other discussion on the topic on this forum but I'm still exercising my forum search skills ;] 

 

I'm sure you've studied all the code in the reference but it looks like you can change the amount of memory and file size. 

 

Quote

I see. He says to insert a clause into those lines to exclude certain files. Are you hinting that if I take out those rsync lines all together it will never sync to the disk at all (but otherwise function properly)?

 

I didn't think of that but why not see what happens? You DO have a test unit, don't you?? ;]

 

You might want to see what rsync is doing, what the aXWv switches do ...

 

 

  • Author

Alright, I got it, thank you! I commented out all the lines in the syncToDisk function (in log2ram code) and replaced them with one "echo "Ok"" (since it was giving me some strange error when I left it all blank). It works like magic! I now modified the log2ram code to give the user an option in the configuration file to do this (i.e. to never write the logs back to the disk). We'll see if he accepts my pull request.

 

Regarding the other issue, logrotate could rotate the logs in the /var/log tmpfs partition in RAM, so that if the computer is running for many days straight, the 40 MB partition shouldn't fill (note: under my arrangement, when the computer reboots /var/log empties anyway - with the exception of the boot log). If it does fill, I could always set logrotate to run more frequently or save fewer logs.

 

Thanks again!

Isaac

Edited by Isaac

Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.