[Bug 1264971] [NEW] Logrotate is not working correctly

Launchpad Bug Tracker 1264971 at bugs.launchpad.net
Mon Dec 30 12:23:22 UTC 2013


You have been subscribed to a public bug by Ubuntu Foundations Team Bug Bot (crichton):

Current logrotate script use "copytruncate" mode, but carbon-cache do
not behave well with such mode : after rotation logfile will start with
huge hole full of NULL character.

To reproduce, you can:

* install package (tested with 0.9.12-1 on Ubuntu "saucy" 13.10)
* Start graphite-carbon (edit /etc/default/graphite-carbon to enable startup, start it with /etc/init.d/graphite-carbon)
* Create some message on logfile, example for listener.log, just open/close a connection on port 2003
* Simulate logrotate action (cp listener.log listener.log.1 && echo -n > listener.log)
* Re-create some message on logfile.
* See that log file start with NULL character


It seems that code support external log rotation if the file is only moved.

>From file lib/carbon/log.py, we can see that if log file no longer exist
it will be re-opened:

  def write(self, data):
    if not self.enableRotation:
      if not exists(self.path):
        self.reopen()

Where self.enableRotation is the carbon's internal log rotation disabled
by Debian packaging.

So a solution could be to disable "copytruncate" in logrotate. The
default mode of logrotate, if I'm not wrong, is to move the file and no
recreating a new file. Thus carbon-cache will detect that logfile no
longer exist and re-open it.

** Affects: graphite-carbon (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: patch
-- 
Logrotate is not working correctly
https://bugs.launchpad.net/bugs/1264971
You received this bug notification because you are a member of Ubuntu Sponsors Team, which is subscribed to the bug report.



More information about the Ubuntu-sponsors mailing list