background

Logrotate

Learn how to manage your server's and application's log files with logrotate.

# On Ubuntu, most log files can be found here:
ls /var/log

# Some may appear in subdirectories
ls /var/log/nginx

# logrotate configurations are stored here:
cd /etc/logrotate.d

# you can review configurations
more nginx

# or create your own
nano rails_testapp

Rails application logrotate configuration

/opt/www/testapp/shared/log/*.log {   
  weekly
  missingok
  rotate 52
  compress
  delaycompress
  notifempty
  copytruncate
}

Please go ahead and leave a comment below if you have any questions about this tutorial.