Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

possible to logrotate rails app with nginx passenger without restart?

It is possible to do logrotate without restarting nginx (just send USR1 signal to nginx it will do the job). I wonder it is possible for my rails app (nginx passenger). It's not worth to restart my rails apps just to do a logrotate.

like image 536
Chamnap Avatar asked Nov 18 '10 03:11

Chamnap


1 Answers

logrotate configuration is pretty simple to get this down

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

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

like image 73
Addy Avatar answered Oct 04 '22 01:10

Addy