logrotate configuration file development and testing

Randall Cook picture Randall Cook · Mar 30, 2012 · Viewed 9.8k times · Source

I have two questions related to developing configuration files for the logrotate tool on Linux systems.

  1. When I make a change to a file in /etc/logrotate.d, do I need to somehow notify logrotate so that it will recognize and respond to the change? It seems to notice changes on its own, eventually, but when testing log rotation specifications it would be useful to force logrotate to react to a new configuration file, rather than waiting for it to next run. Is this possible?

  2. If there is a problem in my logrotate configuration file, are errors reported and if so where can I find them?

Also, if there are common development patterns and techniques to follow when developing logrotate configuration files, please share them. If it matters, I am using Ubuntu 10.04.

Answer

johnshen64 picture johnshen64 · Mar 31, 2012
  1. since the files in /etc/logrotate.d are included in include /etc/logrotate.d

include /etc/logrotate.d

so it is automatically updated when you change/add files in tha directory.

logrotate -f /etc/logrotate.conf can let it run.

  1. usually after changing your configuration, you should run it manually once and it will tell you if there is any error. error should by default also go to syslog, normally.