Temporarily Disable Logrotation for a Service

LinuxOn most Linux systems services install logrotate configuration files in /etc/logrotate.d/. Sometimes you want to temporarily disable log rotation for a service without deleting the configuration file. So how do you do that? A look at the man page shows us this option:

include file_or_directory
Reads the file given as an argument…The only files which are ignored are files which are not regular files (such as directories and named pipes) and files whose names end with one of the taboo extensions**, as specified by the tabooext directive.

  tabooext [+] list
The current taboo extension list is changed (see the include directive for information on the taboo  extensions). If  a + precedes the list of extensions, the current taboo extension list is augmented, otherwise it is replaced. At startup, the taboo extension list contains .rpmsave, .rpmorig, ~, .disabled, .dpkg-old, .dpkg-dist, .dpkg-new, .cfsaved, .ucf-old, .ucf-dist, .ucf-new, .rpmnew, .swp, .cfsaved, .rhn-cfg-tmp-*

So it’s simply a case of renaming the file so that it has a .disabled extension. For example:

sudo mv apache2 apache2.disabled

Leave a Reply

Your email address will not be published. Required fields are marked *