Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-9358

Log rotation can overwrite previous log files

    • Fully Compatible
    • ALL

      Issue Status as of April 15, 2014

      ISSUE SUMMARY
      If one rotates the log twice within one second, the previously rotated log will get overwritten by the new log. This is because the timestamped filename is not unique and the rename() function clobbers the destination with no warning.

      USER IMPACT
      Users rotating a log more than once per second will lose all log information from the last log rotation up to that point.

      Enterprise users using the 2.6.0 audit facility will also be affected by this issue, and issuing more than one log rotation per second will result in lost audit logs.

      WORKAROUNDS
      Wait more than 1 second between log rotations.

      RESOLUTION
      The rename() function no longer clobbers existing log files, but fails with an error message if the destination file already exists.

      AFFECTED VERSIONS
      All recent production releases up to 2.6.0 are affected.

      PATCHES
      The patch is included in the 2.6.1 production release.

      Original description

      If one rotates the log twice within one second, the previously rotated log will get overwritten by the new (and probably very small) log. This is because the timestamped filename is not unique and the rename() function clobbers the destination with no warning.

            Assignee:
            spencer@mongodb.com Spencer Brody (Inactive)
            Reporter:
            milkie@mongodb.com Eric Milkie
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: