Jump to content

Recommended Posts

Posted

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?

Posted

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?

Posted (edited)

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
Posted

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 ...

 

 

Posted (edited)

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.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines