I have /etc/logrotate.d directory populated with files; each service, such as httpd, gets it's own logrotate config file.

The contents in the /etc/logrotate.d dir are configured to rotate after 5k.

I also have a /etc/logrotate.conf file which is not in cron yet. It's configured to: rotate log files weekly

weekly   # keep 4 weeks worth of backlogs
rotate 4 # create new (empty) log files after rotating old ones
create   # use date as a suffix of the rotated file
dateext  # uncomment this if you want your log files compressed

# RPM packages drop log rotation information into this directory
include /etc/logrotate.d

# no packages own wtmp and btmp -- we'll rotate them here
/var/log/wtmp { monthly create 0664 root utmp minsize 1M rotate 1 }
/var/log/btmp { monthly create 0664 root utmp minsize 1M rotate 1 }

Below is a typical config file in the /etc/logrotate.d/ directory:

/var/log/httpd/*log { size 5k 
postrotate /sbin/service httpd reload > /dev/null 2>/dev/null || true endscript }

My questions is where else on the server that I have to configure so that the files in the /etc/logrotate.d directory are rotated after 5k. And that /etc/logrotate.conf is configured to rotate as configured?

3 Answers 3


That all looks good to me. You shouldn't have to change anything at all. Once logrotate starts getting executed things should start getting rotated as expected. One caveat is that it may take one full rotation cycle before things actually start getting rotated. There are built-in safeguards to prevent rotating a file too often. You can monitor the process by checking out the logrotate state file: /var/lib/logrotate.status. It contains a list of all files that logrotate is managing and when each one was last rotated.


It sounds good but take care that logrotate is not a daemon and logs will not be rotated at 5k but only if the size is bigger than 5k when logrotate is executed. By default it is only run once a day.

From man logrotate:

Normally, logrotate is run as a daily cron job.

The logrotate cron file is usually /etc/cron.daily/logrotate. You must move it in /etc/cron.hourly if you want logrotate to verify logs every hour or make a custom cron to execute it more frequently.

logrotate -d config_file
   -d     Turns on debug mode and implies -v.  In debug mode, no changes will be made to the logs or to the logrotate state file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.