Difference between revisions of "Logrotate"

From ArchWiki
Jump to navigation Jump to search
(→‎logs not being rotated: this can't be a widespread problem: the files have correct ownership on installation, and only root can create files in /etc/logrotate.d)
m (I had to google and visit a bunch of sites to be reminded about man page)
Line 36: Line 36:
* [http://wiki.gentoo.org/wiki/Logrotate Logrotate on Gentoo Linux Wiki]
* [http://wiki.gentoo.org/wiki/Logrotate Logrotate on Gentoo Linux Wiki]
* [http://linux.die.net/man/8/logrotate logrotate(8) Manual page]

Revision as of 17:48, 23 March 2016

From https://fedorahosted.org/logrotate/:

The logrotate utility is designed to simplify the administration of log files on a system which generates a lot of log files. Logrotate allows for the automatic rotation compression, removal and mailing of log files. Logrotate can be set to handle a log file daily, weekly, monthly or when the log file gets to a certain size.

By default, logrotate's rotation consists of renaming existing log files with a numerical suffix, then recreating the original empty log file. For example, /var/log/syslog.log is renamed /var/log/syslog.log.1. If /var/log/syslog.log.1 already exists from a previous rotation, it is first renamed /var/log/syslog.log.2. (The number of backlogs to keep can be configured.)


Logrotate can be installed with the logrotate package. It is installed by default as it is member of the base group.

By default, logrotate runs daily using a systemd timer: logrotate.timer.


The primary configuration file for logrotate is /etc/logrotate.conf; additional configuration files are included from the /etc/logrotate.d directory.


exim log not rotated

If you have set the olddir variable in /etc/logrotate.conf, you will get a message such as:

error: failed to rename /var/log/exim/mainlog to /var/log/old/mainlog.1: Permission denied

To fix this, add the user exim to the group log. Then change the group of the olddir, usually /var/log/old, to log instead of the default root.

See also