LoginSignup
19
21

More than 5 years have passed since last update.

Phusion Passengerのログローテート設定

Posted at

ミドルウェアにPassengerを利用してRailsアプリをホストしている場合、ログのサイズには要注意。いや、これはあらゆるログそうなんですけど、そのまま放置するとproduction.logが無限に増大するなんてアレな感じになる。そこで通常のログと同様logrotateを利用するのは同様なのだけど、postrotatetouch restart.txt するのがポイント。

こんな感じ。

# /etc/logrotate.d/passenger.log
/path/to/app/shared/log/*log {
  notifempty
  daily
  missingok
  rotate 3650
  compress
  delaycompress
  sharedscripts
  create 0644 apache-user apache-group
  dateext
  postrotate
    touch /path/to/app/current/tmp/restart.txt
  endscript
}

rotateアノテーションを忘れるとログが消えちゃうので注意。/path/to/app の辺りは当然ながらアプリケーションのパスに書き換えること。

19
21
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
19
21