Reputation: 89
I want to change my logrotate.conf file to compress and save the last 14 days worth of system log files. Will these setting work if placed in my configuration file?
rotate 14
compress
extension log
create 640 www-data users
}
Upvotes: 2
Views: 9978
Reputation: 1934
You need to understand what each parameter of logrotate
does, for debian you can find the info here
Here you are confusing rotate count with maxage, the rotate count specifies that log files are rotated count times before being removed or mailed to the address specified in a mail directive. e.g.
# sample logrotate configuration file
compress
/var/log/messages {
rotate 5
weekly
postrotate
/usr/bin/killall -HUP syslogd
endscript
}
The first few lines set global options; in the example, logs are compressed after they are rotated. The next section of the config file defines how to handle the log file /var/log/messages
. The log will go through five weekly rotations before being removed.
The option you are looking for is maxage count
Remove rotated logs older than count days. The age is only checked if the logfile is to be rotated. The files are mailed to the configured address if maillast and mail are configured.
Upvotes: 3