Logrotate

logrotate is a tool for log maintenance. Log files tend to grow, and from time to time you have to rotate them (delete them and create new ones). Instead of deleting you may move them to some other place, compress, mail etc. logrotate can automate this process.

Installation
Emerge it,

A cronjob should be added automatically. logrotate is called once per day by default but it doesn't mean your logs will be rotated daily. If you want to change the parameters logrotate is being called with, you can edit them in.

Configuration
Main configuration file is, other configuration files are included from directory.

Configuration syntax
The basic element of the configuration file is a section. It consists of a log file to rotate ( in this example), and options in curly braces. When you specify an option outside of any section, it is interpreted as a default setting.

Common Options Reference

 * compress - compress rotated logs using gzip
 * create mode owner group - specify permissions (as in ) and ownership for created logs
 * daily, weekly, monthly - how often should logs be rotated
 * size size[G|M|k] - rotate, if log-file size exceeds size bytes / kilobytes / megabyte / gigabytes
 * mail address - mail rotated logs to specified address
 * olddir directory - move rotated logs to the specified directory
 * rotate count - keep count rotated log files

for more options see

Known bugs
Be careful when rotating and compressing files. If you are using genlop you will have to specify every single emerge.log file using option -f (compressed files will work, too), e.g.

logrotate doesn't actually rotate logs
If you're having problems with logrotate not rotating your logs, try running it manually with the -d option to force a debug output:.

Note with the -d option, logrotate will NOT actually rotate your logs, it must be run without the -d option to rotate.

If nothing seems to be wrong there, ensure that your cron is working properly as logrotate depends on this.

Logrotate