Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I followed this link to change log-rotate configuration. https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/s1-logfiles-locating.html

After I made the change to config file, what should I do to let this take effect?

share|improve this question

3 Answers 3

up vote 4 down vote accepted

logrotate uses crontab to work. It's scheduled work, not a daemon, so no need to reload its configuration.
When the crontab executes logrotate, it will use your new config file automatically.
If you need to test your config you can also execute logrotate on your own with the command:

logrotate /you/config/file

Or as mentioned in comments, identify the logrotate line in the output of the command crontab -l and execute the command line refer to slm's answer to have a precise cron.daily explanation

share|improve this answer
1  
Just to add to your answer, the cron entry for logrotate is scheduled to run once a day. –  Ketan Feb 20 at 17:12
    
@Ketan, so, how can i make it affect right away? thanks –  No Name Feb 20 at 17:17
    
Not sure. One possibility is to find the corresponding entry from crontab via crontab -l and execute it. –  Ketan Feb 20 at 17:27
1  
If you want it to take effect immediately run the cron afterwords. –  slm Feb 20 at 17:29
    
You can also just run logrotate directly as mentioned in the answer. –  goldilocks Feb 20 at 17:31

Most of the logrotate setups I've seen on various distros runs out of the /etc/cron.daily. There's a shell script there aptly named logroate.

Example

$ ls -l /etc/cron.daily/logrotate 
-rwxr-xr-x 1 root root 180 May 18  2011 /etc/cron.daily/logrotate

Manual run

If you want to make it run manually simply run the script as root.

$ sudo /etc/cron.daily/logrotate

If you take a look at a script that's typically there it shows you how you can also run logrotate manually, by simply running logroate + the path to its configuration file..

#!/bin/sh

/usr/sbin/logrotate /etc/logrotate.conf
EXITVALUE=$?
if [ $EXITVALUE != 0 ]; then
    /usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]"
fi
exit 0
share|improve this answer

It should be automatic via cron. You can force it to test your changes.

For global logrotate:

sudo logrotate -v -f /etc/logrotate.conf

For a single conf file:

sudo logrotate -v -f /etc/logrotate.d/someapp.conf
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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