Uploaded image for project: 'ZooKeeper'
  1. ZooKeeper
  2. ZOOKEEPER-1983

Append to zookeeper.out (not overwrite) to support logrotation



    • Type: Bug
    • Status: In Progress
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 3.3.5, 3.3.6, 3.4.6
    • Fix Version/s: 3.7.0, 3.5.10
    • Component/s: server
    • Labels:
    • Environment:

      CentOS 5.x (and probably any Linux distribution for that matter)


      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 issue was found in a 3.3.5 production system, however code in trunk has the same issue.


        1. ZK1983.patch
          1 kB
          Shyamal Prasad
        2. ZOOKEEPER-1983.patch
          1 kB
          Shyamal Prasad



            • Assignee:
              shyamal Shyamal Prasad
              shyamal Shyamal Prasad
            • Votes:
              1 Vote for this issue
              4 Start watching this issue


              • Created: