Logrotate: Difference between revisions
From charlesreid1
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
==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 <code>/etc/logrotate.d/</code> 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 <code>/var/log/apache2/*</code>. | |||
Then we can create a file at <code>/etc/logrotate.d/apache.conf</code> to hold the Apache logrotate options: | |||
<pre> | |||
/var/log/apache2/* { | |||
weekly | |||
rotate 3 | |||
size 10M | |||
compress | |||
delaycompress | |||
} | |||
</pre> | |||
==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 | 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. :) | 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 <code>/etc/logrotate.d/rsyslog</code> | |||
Revision as of 15:42, 15 November 2018
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