Logrotate is a tool that facilitates the management of logs files through a process known as log rotation.

You can use logrotate to automatically rotate log files, compress files and remove them in order to optimize disk space on your system.

Use cases

The use cases of logrotate are multiple:

  • Set a rotation for log files: a daily, weekly, monthly or yearly basis.
  • Compress or remove old log files to save hard disk space.
  • Delete log files that have stayed up to a particular time limit.
  • Limit the size of individual logs files.