Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

logrotate configuration file development and testing

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.

like image 559
Randall Cook Avatar asked Mar 30 '12 19:03

Randall Cook


2 Answers

  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.
like image 94
johnshen64 Avatar answered Oct 24 '22 17:10

johnshen64


Logrotate.conf is executed as a cron job in linux, So u dont need to update any other file after changing /etc/logrotate.d You can run it forcefully by using the command "logrotate -f /etc/logrotate.conf", or else if you dont want to run it and just want to check for the errors or the possible outcome of your changes, you can run it with --d option "logrotate -d /etc/logrotate.conf". I hope this helps.

like image 37
jayant Avatar answered Oct 24 '22 17:10

jayant