Public bug reported:

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

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1264971

Title:
  Logrotate is not working correctly

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/graphite-carbon/+bug/1264971/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to