Linux – Back up log files in Redhat Enterprise Linux 5

backuplinuxlog-filesrhel5

Hai guys/gals,

How can i backup var/log files/folders ?

  • Log files/folders changes (log updates) should be automatically updated from original log file/folder to duplicate file/folder.

Best Answer

If I understand, what you need,then simplest thing might be just to specify multiple saving locations in /etc/syslog.conf, example from syslog manpage.

#Kernel messages are first, stored in the kernel file, critical messages and higher ones also go to another host and to the console

kern.*                       /var/adm/kernel
kern.crit                    @finlandia
kern.crit                    /dev/console
kern.info;kern.!err          /var/adm/kernel-info

As you can see, every kernel message is stored in /var/adm/kernel,and every critical kernel message will be sent to logserver on machine 'finlandia' and displayed on console as well. You will have to edit logrotate in /etc/logrotate.d/syslog, so logs will be rotated properly on your backup partition.

I believe this is better solution than backup with cron,because backup-logs are created everytime something is logged :-)

Anyway, if you will be interested in creating a backup log-server on remote machine, I recommend NSA RHEL Security Guide. Page 66. It helped us quite a lot when I was setting up a Rhel server with my classmates :-)

Related Topic