[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#445203: debian-policy: 10.8. Log files: /etc/logrotate.d/<package> preferred



Hi!

On Wed, 2010-07-07 at 08:59:24 -0700, Russ Allbery wrote:
> I propose the following patch for this bug instead in order to get it
> clear of this discussion.  We can always go back and sort out whether it
> should use invoke-rc.d after we work through the other bug.
> 
> Does this look okay?
> 
> diff --git a/policy.sgml b/policy.sgml
> index 7736ddb..a7bf76e 100644
> --- a/policy.sgml
> +++ b/policy.sgml
> @@ -7903,11 +7903,13 @@ ln -fs ../sbin/sendmail debian/tmp/usr/bin/runq
>  	</p>
>  
>  	<p>
> -	  Log files must be rotated occasionally so that they don't
> -	  grow indefinitely; the best way to do this is to drop a log
> -	  rotation configuration file into the directory
> -	  <file>/etc/logrotate.d</file> and use the facilities provided by
> -	  logrotate.<footnote>
> +	  Log files must be rotated occasionally so that they don't grow
> +	  indefinitely.  The best way to do this is to install a log
> +	  rotation configuration file in the
> +	  directory <file>/etc/logrotate.d</file>, normally
> +	  named <file>/etc/logrotate.d/<var>package</var></file>, and use
> +	  the facilities provided by <prgn>logrotate</prgn>.
> +	  <footnote>
>  	    <p>
>  	      The traditional approach to log files has been to set up
>  	      <em>ad hoc</em> log rotation schemes using simple shell
> @@ -7932,17 +7934,20 @@ ln -fs ../sbin/sendmail debian/tmp/usr/bin/runq
>  	    section="8">):
>  	  <example compact="compact">
>  /var/log/foo/*.log {
> -rotate 12
> -weekly
> -compress
> -postrotate
> -/etc/init.d/foo force-reload
> -endscript
> +    rotate 12
> +    weekly
> +    compress
> +    missingok
> +    postrotate
> +        [ -f /var/run/foo.pid ] && kill -s HUP `cat /var/run/foo.pid`
> +    endscript

Probably better to recommend using start-stop-daemon, as it's more
robust and should properly handle for example the case of a stale pid
file pointing to the wrong binary (which with HUP might terminate an
unsuspecting victim).

>  }
>  	  </example>
>  	  This rotates all files under <file>/var/log/foo</file>, saves 12
> -	  compressed generations, and forces the daemon to reload its
> -	  configuration information after the log rotation.
> +	  compressed generations, and tells the daemon to reopen its log
> +	  files after the log rotation.  It skips this log rotation
> +	  (via <tt>missingok</tt>) if no such log file is present, which
> +	  avoids errors if the package is removed but not purged.
>  	</p>
>  
>  	<p>

With that comment addressed, seconded.

regards,
guillem

Attachment: signature.asc
Description: Digital signature


Reply to: