The default configuration file is /etc/logrotate.conf
# see "man logrotate" for details
# rotate log files weekly
weekly
# keep 4 weeks worth of backlogs
rotate 4
# create new (empty) log files after rotating old ones
create
# uncomment this if you want your log files compressed
#compress
# RPM packages drop log rotation information into this directory
include /etc/logrotate.d
# no packages own wtmp -- we'll rotate them here
/var/log/wtmp {
monthly
minsize 1M
create 0664 root utmp
rotate 1
}
# system-specific logs may be also be configured here.
Service or server specific configurations stored in /etc/logrotate.d directory, for example here is sample apache logrotate configuration file:
less /etc/logrotate.d/httpd
/var/log/httpd/*log {Now you need to set a cronjob for the logrotation to run. crontab -e
monthly
rotate 52
compress
missingok
notifempty
sharedscripts
postrotate
/sbin/service httpd reload > /dev/null 2>/dev/null || true
endscript
}
00 00 * * * /usr/sbin/logrotate -s /home/humanlinux/config/logrotate.status
Cron ensures that the command runs at midnight everyday. The command has three parts. /usr/sbin/logrotate
is the path to logrotate. The -s /home/humanlinux/config/logrotate.status
option specifies where logrotate keeps its status information. This file has to be writeable by the user running the cron.
run the command
/usr/sbin/logrotate -f
/etc/logrotate.conf to begin the log rotationThanks & Regards
tell2humanlinux@gmail.com
I always spent my half an hour to read this web
ReplyDeletesite's articles or reviews daily along with a mug of coffee.
Here is my weblog - diets that work for women
Potong Pasir MRT at the doorstep, residents can easily access almost to any destination through.
ReplyDeletethe interlace condo (theinterlacecondo.sg)