RAMLOG

Section:     System administration tools (8)     Updated: March 2010
Index

 

NAME

ramlog - daemon that places /var/log into ramdisk on startup and copies it back to harddisk on shutdown  

SYNOPSIS

/etc/init.d/ramlog start | stop | status | restart | reload | enable | disable | getlogsize | teststartstop | version  

DESCRIPTION

Ramlog act as a system daemon. On startup it creates ramdisk, it copies files from /var/log into ramdisk and mounts ramdisk as /var/log. All logs after that will be updated on ramdisk. Logs on harddrive are kept in folder /var/log.hdd which is updated when ramlog is restarted or stopped. On shutdown it saves log files back to harddisk so logs are consistent. Ramlog 2.x is using tmpfs by default, ramfs and kernel ramdisk are suppored as well. Program rsync is used for log synchronization.


Note: Logs not saved to harddrive are lost in case of power outage or kernel panic.

Install ramlog if you have enough of free memory and you want to keep your logs on ramdisk. It is good for notebook users, for systems with UPS or for systems running from flash - to save some write cycles.

How it works and what it does:

1.
Ramlog starts among the first daemons (it depends on other daemons you have installed).
2.
Directory /var/log.hdd is created and hardlinked to /var/log.
3.
In case tmpfs (default) or ramfs is used, it is mounted over /var/log
If kernel ramdisk is used, ramdisk created in /dev/ram9 and it is mounted to /var/log, by default ramlog takes all ramdisk memory specified by kernel argument "ramdisk_size".
5.
All other daemons are started and all logs are updated in ramdisk. Logrotate works on ramdisk as well.
6.
In case ramlog is restarted (by default it is one time per day), directory /var/log.hdd is synchronized with /var/log using rsync. Frequency of the automatic log saves can be controller via cron, by default, the ramlog file is placed into /etc/cron.daily
7.
On shutdown ramlog shuts among the last daemons.
8.
During ramlog stop phase files from /var/log.hdd are synchronized with /var/log
Then /var/log is unmounted, /var/log.hdd is unmounted as well and empty directory /var/log.hdd is deleted.

 

OPTIONS

start
This argument starts ramlog. However ramlog cannot be started anytime because /var/log can be already in use. That's why the best time to start ramlog is on system startup
stop
Stops ramlog. The best time to stop ramlog is on system shutdown
status
Displays the status - if ramlog is started or stopped start
restart
It is not really possible to "restart" ramlog. Ramlog called with this parameter saves all new or updated files from /var/log into /var/log.hdd
reload
It does the same as restart
enable
Configures ramlog as system daemon - it will start and stop with your system
disable
Disables ramlog as system deamon. Use this option if you want ramlog to be disabled. In case you use any other external program to disable ramlog as system daemon, your unsaved logs will be lost(!)
getlogsize
ramlog returns the size of /var/log. It can be handy to know log size if you are about to change kernel parameter ramdisk_size
teststartstop
ramlog makes a test for open files in /var/log. If there are no open files, ramlog can be started or stopped
version
Displays actual version of ramlog

 

CONFIGURATION

Ramlog configuration file is located in /etc/syconfig/ramlog on rpm based systems and in /etc/default/ramlog on deb based systems and you can set there below variables:

Variable (with
default value):
Description:
RAMDISKTYPE=0
# Values:
# 0 - tmpfs (can be swapped) - default
# 1 - ramfs (no max size in older kernels,
# cannot be swapped, not SELinux friendly)
# 2 - old kernel ramdisk
TMPFS_RAMFS_SIZE=
#Maximum size of memory to be used by tmpfs or ramfs.
# The value can be percentage of total RAM or size in megabytes - for example:
# TMPFS_RAMFS_SIZE=40%
# TMPFS_RAMFS_SIZE=100m
# Empty value means default tmpfs/ramfs size which is 50% of total RAM.
# For more options please check 'man mount', section 'Mount options for tmpfs'
# (btw - ramfs supports size limit in newer kernels
# as well despite man says there are no mount options)
# It has only effect if RAMDISKTYPE=0 or 1
KERNEL_RAMDISK_SIZE=MAX
#Kernel ramdisk size in kilobytes or MAX to use entire ramdisk.
#It has only effect if RAMDISKTYPE=2
LOGGING=1
# 0=off, 1=on Logs can be found in /var/log/ramdisk
LOGNAME=ramlog
# name of the ramlog log file (makes sense if LOGGING=1)
VERBOSE=1
# 0=off, 1=on (if 1, teststartstop puts detials
# to the logs and it is called after start or stop fails)

 

AUTHOR

Written by Jan Andrejkovic  

DOWNLOAD

Latest version can be downloaded from http://www.tremende.com/ramlog  

BUGS

Report bugs to <jandrejk on gmail point com>  

COPYRIGHT

Copyright © 2001,2010 Jan Andrejkovic
This is free software. You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>. There is NO WARRANTY, to the extent permitted by law.


 

Index

NAME
SYNOPSIS
DESCRIPTION
OPTIONS
CONFIGURATION
AUTHOR
DOWNLOAD
BUGS
COPYRIGHT