I want to use logrorate. The logs are written to /var/log/curLog/log.log. As mentioned in the documentation, I create a new file in /etc/logrotate.d/ with name currentLog. The content of currentLog is:

    size 100k,
    rotate 10,

But the logs increase above the 100k size, and nothing happens. Should I restart some service or do some other operations?


You have 3 options that dictate the when the rotation occurs.

size 100k   # if size > 100k
daily       # once a day
notifempty  # not if == 0k

Remove the daily and it should occur more regularly when the file is > 100k

Second, If the process that creates the log file is a daemon that keeps the file open, you will most likely need to restart that process or at least signal it to open a new log file once logrotate has moved the old one.

For example, Apache httpd can graciously reload config and reopen log files with the kill -SIGUSR1 <pid> or /usr/sbin/apachectl graceful command rather than being completely restarted.

        /usr/sbin/apachectl graceful > /dev/null

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.