Logrotate
From charlesreid1
Contents
Logrotate utility
Man page: http://manpages.ubuntu.com/manpages/precise/man5/rsyslog.conf.5.html
The man page sucks.
How to use
Basic usage: https://www.tecmint.com/install-logrotate-to-manage-log-rotation-in-linux/
Create files in /etc/logrotate.d/
that correspond to various log files. The content of these files is a configuration file that look a bit like nginx...
For example, suppose we wanted to rotate logs for Apache, which stores its logs in the folder /var/log/apache2/*
.
Then we can create a file at /etc/logrotate.d/apache.conf
to hold the Apache logrotate options:
/var/log/apache2/* { weekly rotate 3 size 10M compress delaycompress }
Logrotate Logstash Elasticsearch
A much better guide from digital ocean is here: https://www.digitalocean.com/community/tutorials/how-to-centralize-logs-with-rsyslog-logstash-and-elasticsearch-on-ubuntu-14-04
this incorporates logstash and elasticsearch. :)
Log rotation in Ubuntu
Log rotation in ubuntu 16.04 is daily by default, with 7 days of backups kept.
Ref: https://askubuntu.com/a/124959
To change this, edit /etc/logrotate.d/rsyslog