Jump to content

Recommended Posts

Posted

Hi.
In the new image of banana pi (Armbian_5.00_Bananapi_Debian_jessie_4.4.1) there is no ramlog. apt-get can not find it. It has been permanently removed?

Posted

Read the download page closely ... Ramlog works only in Wheezy or Jessie without Systemd.

Posted

Oh, sorry. I did not understand that "w/o" = without. google translator.
Since the adoption of systemd by debian, I've only had problems. Do one thing and do it well, ha!!! :angry:
Damn systemd. Damn RedHat.

Sorry Igor

Posted

Yes it should. If not, do not hesitate to open an issue on github

I use basic functions of debian jessie, I don't see any problem for ram2log to work on your system.

I like your tool. Could you tell a bit more about the way it works?

  1. There is a size of 40MB. Does that mean that logs are written to disk as soon as 40MB of logs are collected, or is this just the size of Ramdisk?
  2. Is it possible that Ram2Log writes the logs every day at a specific time out of this ramdisk?
Posted

I modified the code to expand to 256 mb.
I changed the cp command for rsync, I do not remember exactly why I did it but surely solved a problem I had.

/usr/local/bin/log2ram:

#!/bin/sh

HDD_LOG=/var/log.hdd/
RAM_LOG=/var/log/
SIZE=256M

case "$1" in
  start)
      [ -d $HDD_LOG ] || mkdir $HDD_LOG
      mount --bind $RAM_LOG $HDD_LOG
      mount --make-private $HDD_LOG
      mount -t tmpfs -o nosuid,noexec,nodev,mode=0755,size=$SIZE ramlog $RAM_LOG
      rsync -aXWv --delete --links $HDD_LOG $RAM_LOG
#      cp -rfup $HDD_LOG -T $RAM_LOG
      ;;

  stop)
      rsync -aXWv --delete --links $RAM_LOG $HDD_LOG
#      cp -rfup $RAM_LOG -T $HDD_LOG
      umount -l $RAM_LOG
      umount -l $HDD_LOG
      ;;

  write)
      rsync -aXWv --delete --links $RAM_LOG $HDD_LOG
#      cp -rfup $RAM_LOG -T $HDD_LOG
      ;;
esac

Posted

 

I like your tool. Could you tell a bit more about the way it works?

  1. There is a size of 40MB. Does that mean that logs are written to disk as soon as 40MB of logs are collected, or is this just the size of Ramdisk?
  2. Is it possible that Ram2Log writes the logs every day at a specific time out of this ramdisk?

 

Hi,

1. The mount folder is a tmpfs, it a static size. So the SIZE variable define the maximal size you allocate into your RAM for the log folder. (Mine is around 25MB)

2. You can make a CRON to make a 'service log2ram restart'. Into my script, the restart function copy the content into the initial disk folder

Posted

 

I modified the code to expand to 256 mb.

I changed the cp command for rsync, I do not remember exactly why I did it but surely solved a problem I had.

 

 

Thank for your suggestions.

You can modify the code depending of your needs. (On a raspberry, 256Mb is the half of my RAM)

The option -u of the cp make a update

       -u, --update              copy  only  when  the  SOURCE file is newer than the destination              file or when the destination file is missing

I think it's enough.

But I will add yours improvements like a option. (Because I like minimalist program without dependencies)

Posted

Hi,

1. The mount folder is a tmpfs, it a static size. So the SIZE variable define the maximal size you allocate into your RAM for the log folder. (Mine is around 25MB)

2. You can make a CRON to make a 'service log2ram restart'. Into my script, the restart function copy the content into the initial disk folder

Thank you for your explanations :)

 

As I am no coder, I'm still not sure how the script actually handles the logs. I understand that the logs are going to your created ramdisk (of the ramdisk-size specified with SIZE paramter), but when are they written do SD card finally? What triggers the writing to SD-Card? A full ramdisk, or a specific time? Or is your script meant to be always holding the logs in Ramdisk, thus losing all logs after a reboot. If this is the case, what happens if your "SIZE=25M" is full with logs? Does Ram2Log delete then the oldest logs according to a rotating principle?

Posted

when are they written do SD card finally?

-> It's a systemd script, so the log are written when the service stop

 

What triggers the writing to SD-Card

-> On a halt, a restart of the service or of the computer

 

is your script meant to be always holding the logs in Ramdisk, thus losing all logs after a reboot

-> No. You will lose your log only if your machine stop brutally (electricity failure for example)

 

what happens if your "SIZE=25M" is full with logs

-> it's like a partition for the log software (syslog) , the syslog will stop writting if it's full until your log rotate with logrotate.It's why you need to adapt this value. you can check the size with : df -h

 

Does Log2Ram delete then the oldest logs according to a rotating principle?

-> It's the job of logrotate, the job of log2ram is to mount a ram folder for your /var/log folder.

 

 

Posted

aaaah thanks for all the answers :)

 

so there is even a program called logotate it the system  :rolleyes: .

 

This sounds all good, so it should be enough if I do a cronjob every morning (?):

 

/etc/cron.daily/log2ram

#!/bin/sh
#save logs from ramdisk to harddrive:
service log2ram restart
Posted
infinity : Yes it's will work. It's do the same as hardvk0 script.

 

 

/etc/cron.daily/log2ram:

#!/bin/sh

test -x /usr/local/bin/log2ram || exit 0
/usr/local/bin/log2ram write

Posted

Ah okay, didn't know that :/. I really don't understand much about all this linux stuff, that is why I'm so dependent on this community  :rolleyes: . Thank you very much :)

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines