Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.
share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

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 :-)

share|improve this answer
    
@AsamTheCamper I hope it's good solution for my doubt. Can you pls give some exampls ? –  Kumar Jan 26 '10 at 4:55
    
and How can i back up /var/log/squid/... files ? –  Kumar Jan 26 '10 at 5:05
add comment

so you want to keep only one backup and not multiple backups for different points in time? than the easiest way to go should by using rsync in crontab to get your files synced every x minutes/hours/days to another folder.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.