What is the best way to make sure a ruby on rails log file doesn't get too large and how would you back them up on Amazon S3?
I know ec2onrails has this build in to the AMI but I'm not sure how to implement it on another machine. Thx
What is the best way to make sure a ruby on rails log file doesn't get too large and how would you back them up on Amazon S3?
I know ec2onrails has this build in to the AMI but I'm not sure how to implement it on another machine. Thx
Your Ruby on Rails log files should be automatically rotated like any other log file (the tool to do this varies from system to system -- it's usually logrotate
on Linux & newsyslog
on BSD systems. Ideally you're sending these logs through the syslog daemon, otherwise you need to make sure that you notify the process writing to the log file that you've rotated it (or the process may keep trying to write to the old log).
Re: backing up the log files, normally you would keep a week (or a month if you feel generous) worth of them locally, and then let them go away -- for troubleshooting you really only need the current log plus a few old ones for comparison. If you need to keep them around for auditing purposes yo can use the backup system of your choice to grab the rotated logs (usually logfile.0
, logfile.1
, etc.). A simple system can also be cobbled together using rsync
(see man rsync
for more details).