#cd /etc/logrotate.d
Step 2 : Create a file apache
#touch apache
/var/log/apache2/*.log {
weekly
missingok
rotate 52
compress
delaycompress
notifempty
create 640 root adm
sharedscripts
postrotate
if [ -f "`. /etc/apache2/envvars ; echo ${APACHE_PID_FILE:- /var/run/apache2.pid}`" ]; then
/etc/init.d/apache2 reload > /dev/null
fi
endscript
}
Description of parameters:
- weekly : Log files are rotated if the current weekday is less then the weekday of the last rotation or if more then a week has passed since the last rotation.
- rotate 52 : Log files are rotated 52 times before being removed
- compress : Old versions of log files are compressed with gzip to save disk space.
- missingok : If the log file is missing, go on to the next one without issuing an error message.
- notifempty : Do not rotate the log if it is empty
- sharedscripts : Single script may be run multiple times for log file entries which match multiple files. If sharedscript is specified, the scripts are only run once, no matter how many logs match the wildcarded pattern. However, if none of the logs in the pattern require rotating, the scripts will not be run at all.
No comments:
Post a Comment