Is it possible to run rails application with nginx-passenger without rebooting?

You can execute logrotate without restarting nginx (just send the signal USR1 to nginx, it will complete the task). Interestingly, this is possible for my rails application (nginx passenger). Do not restart applications with rails to do logrotate.

+4
source share
2 answers

If you are talking about rails application log rotation, you can do this by putting

config.logger = Logger.new(config.log_path, 10, 1024**2) 

in the environment file. The second argument is the number of .log files that you would like to save, and the third is the size in bytes that the files can reach before they are rotated. This configuration means 10 files of 1 megabyte size. It may not be as easy to configure as logrotate (without support for compression, etc.), but it allows you to store all your log files in your application. This usually works for me.

Also found this if you want to stick with log rotation through nginx.

+3
source

Logrotate configuration is pretty simple to get it down

 /path/to/rails_apps/*/shared/log/*.log { daily missingok rotate 30 compress delaycompress copytruncate } 

copytruncate basically copies the contents to a new file and truncates the old file. this eliminates the need for a restart.

+25
source

All Articles