TH's Notes
  • Home
  • Categories
  • Tags
  • Archives

Setting up logrotate for production server

This article will demonstrate how to use logrotate to maintain log files of rails.

  • Switch to root
sudo su -l
  • Define a file to maintain log files of rails

Assuming your app name is myflix, create /etc/logrotate.d/rails with following content:

/etc/logrotate.d/rails:

/home/deployer/apps/myflix/current/log/*.log {
  daily
  missingok
  rotate 7
  compress
  delaycompress
  notifempty
  copytruncate
  sharedscripts
  postrotate
    service sidekiq restart
    service unicorn restart
  endscript
}

You may execute the command below for testing

logrotate -vf /etc/logrotate.conf
Comments
comments powered by Disqus

  • « Setting up Nginx+Unicorn production server
  • Setting up a rails production server on Ubuntu »

Published

Mar 30, 2015

Category

Web

Tags

  • rails 63
  • Powered by Pelican. Theme: Elegant by Talha Mansoor