Linux – Best Practices for rotating syslog logs on RHEL with different schedules

best practiceslinuxredhatsyslog

OS:
Running RHEL 5.6.

Situation:
I need to rotate /var/log/messagees on a different schedule than the rest of the syslog logs.

By default syslog logs are rotated weekly based on the /etc/logrotate.conf and /etc/logrotate.d/syslog configuration files.

If you look at /etc/logrotate.d/syslog you will find that there is one logrotate configuration block for all of the logs. If I want /var/log/messages to rotate on a different schedule I need to create a separate configuration block for it. This would result in restarting syslogd twice (based on copying the existing config).

Question:
Is there a way to rotate /var/log/messages on a different schedule than the other syslog logs without having to send HUP to syslogd twice? Or does this even matter? What is the best practice here?

Best Answer

Set up a separate block for the messages log in /etc/logrotate.d/rsyslog (or whatever it's called on your install). It should use the setting for the specific log file match preferentially to a general one.

No, as Zoredache mentioned, multiple HUPs shouldn't break anything unless you're really hammering rsyslog anyway.