LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Logrotate causes rsyslogd to stop working after log rotation. Please help! (https://www.linuxquestions.org/questions/linux-newbie-8/logrotate-causes-rsyslogd-to-stop-working-after-log-rotation-please-help-4175477629/)

linuxr00lz2013 09-18-2013 12:58 PM

Logrotate causes rsyslogd to stop working after log rotation. Please help!
 
hello all

I noticed that each time logrotate runs on my RHEL 5.9 Linux server, it causes rsyslogd to stop working and I have to manually restart it. I am trying to configure logrotate that it restarts rsyslog after its completed rotating the logs. I placed the following in my logrotate.conf for one of the logs for testing purposes. Please let me know if this looks correct:

Code:

/var/logs/example/example.log {
    daily
    rotate 365
    create 0644 root root
    postrotate
        reload rsyslog >/dev/null 2>&1 || true
    endscript
}

Does this look good and how should I go about testing if this is working?


Thanks for all of your help!!

druuna 09-19-2013 05:56 AM

Not sure if reload rsyslog >/dev/null 2>&1 || true is the correct entry, try the following:
Code:

/var/log/firewall {
    daily
    compress
    rotate 365
    create 0644 root root
    postrotate
        /etc/init.d/rsyslog reload
    endscript
}

I also added an extra option (green one), which might be handy (compressing the rotated files).

Testing can be done as follows:

- logrotate -d /etc/logrotate.conf to check (no changes are made, just for debugging),
- logrotate -fv /etc/logrotate.conf force logrotate to do its job,
- Have a look at the log file: /var/lib/logrotate/status (location might be different).

Also have a look here: Manage Linux log files with Logrotate


All times are GMT -5. The time now is 03:03 PM.