May 2017
Beginner
552 pages
28h 47m
English
The system's logrotate configuration files are held in /etc/logrotate.d. Most Linux distributions have many files in this folder.
We can create a custom configuration for a log file (say /var/log/program.log):
$ cat /etc/logrotate.d/program
/var/log/program.log {
missingok
notifempty
size 30k
compress
weekly
rotate 5
create 0600 root root
}
This is a complete configuration. The /var/log/program.log string specifies the log file path. Logrotate will archive old logs in the same directory.