概要 Railsのログをローテートする方法はいくつかあります。 代表的なものにRailsのloggerに組み込まれているログローテーション機能を使う方法がありますが、Passenger環境で使う場合に多少の手直しが必要になってきます。(ログローテート後にPassengerがログにアクセスできなくなるためエラーが起きる) Passenger + Rails 環境でログをローテートする場合、logrotateを使うのが簡単です。 コード 次のようなファイルを作成する /etc/logrotate.d/passenger /var/www/app/az-nyan/current/log/production.log { weekly missingok rotate 30 compress delaycompress sharedscripts postrotate touch /var/w