caching logfiles

3rd Party Package Requesting

Postby xj600 » Wed May 24, 2006 3:32 pm

Im looking for a way to cache logfiles for say 1-3-6 or 12 houers befor writing them to disk.
When im downloading using torrent the disk never goes to "sleep" and the truble is that the logfile get's full to fast.
Therefor i thought that if i had a ramdisk to save the logfiles for some time and then "move" this files to /dev/hda every X houers would increase the lifespan of my realy old harddisk...
User avatar
Posts: 3
Joined: Thu May 12, 2005 2:06 am

Postby Lightning » Wed May 24, 2006 9:41 pm

Actually what you are asking would really not be terribly difficult to accomplish. If you have a 4MB extra ramdisk then you could save quite a few logs to it because the default log size is only 50K. So I don't think you would really even need to save a hard copy. Just copy the /bin/savelogs to /boot/bin and change the directory it copies the log files to so it is /mnt/ram1 instead of /home/root. This is a multifunction script but all you need to change is the savelog function. You should also change the rmlog function in the same manor. Remember there are only 256 file descriptors so you need to remove logs to keep the total number below 256 at all times. Of course if you really want to save more logs than that you can also increase the log file size to prevent going over the 256 file descriptor limit. you can go up to about 200K for log size if you really need it which would in essence be about 1000 standard logs.

On a secondary note, there are many theories about how long a drive will last and whether starting and stopping them is better or worse. But if you have packages installed then most likely the drive is going to be spinning up anyway and you may find it better to just set the sleep timeout to zero and just let the drive run.
If you are afraid that you might make a mistake. The chances are high that you will never learn anything.
User avatar
Posts: 12081
Joined: Wed Nov 14, 2001 6:50 am
Location: Oregon, USA

Return to 3rd Party Package Requesting

Who is online

Users browsing this forum: No registered users and 9 guests