4
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Railsで使いそうなlogrotateの設定まとめ

Posted at

CentOSでの例。

Rails

/etc/logrotate.d/rails
/path-to-app/log/*.log {
    weekly
    rotate 15
    missingok
    notifempty
    copytruncate
    dateext
    compress
    create 0666 username username

    lastaction
        pid=/path-to-app/tmp/pids/unicorn.pid
        test -s $pid && kill -USR1 "$(cat $pid)"
    endscript
}

nginx

/etc/logrotate.d/nginx
/var/log/nginx/*log {
    create 0644 nginx nginx
    daily
    rotate 10
    missingok
    notifempty
    compress
    sharedscripts
    postrotate
        /etc/init.d/nginx reopen_logs
    endscript
}

NewRelic

/etc/logrotate.d/newrelic-sysmond
/var/log/newrelic/nrsysmond.log {
    rotate 7
    daily
    missingok
    notifempty
    sharedscripts
    copytruncate
    compress
}
4
5
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
4
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?