You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by "Shyamal Prasad (JIRA)" <ji...@apache.org> on 2014/07/22 23:18:41 UTC

[jira] [Created] (ZOOKEEPER-1983) Append to zookeeper.out (not overwrite) to support logrotation

Shyamal Prasad created ZOOKEEPER-1983:
-----------------------------------------

             Summary: Append to zookeeper.out (not overwrite) to support logrotation
                 Key: ZOOKEEPER-1983
                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1983
             Project: ZooKeeper
          Issue Type: Bug
          Components: server
    Affects Versions: 3.3.5
         Environment: CentOS 5.x (and probably any Linux distribution for that matter)
            Reporter: Shyamal Prasad


Currently zkServer.sh will redirect output to zookeeper.out using a simple shell redirect. 

When logrotate (and similar tools) are used to rotate the zookeeper.out file with the 'copytruncate' semantics (copy the file, truncate it to zero bytes) the next write results in a sparse file with the write at the offset of the last file. Effectively the log file is now full a null bytes and it is hard to read/use the file (and the rotated copies). 

Even worse, the result is zookeeper.out file only gets "larger" (though sparse) and after a while on a chatty system it takes significant CPU resources to compress the file (which is all nulls!)

The simple fix is to append to the file (>>) instead of a simple redirection (>)



--
This message was sent by Atlassian JIRA
(v6.2#6252)