[logrotate] Sharedscripts option conflicts with delaycompress option

Bug #1486690 reported by Miroslav Anashkin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Fuel for OpenStack
Fix Released
High
Bartłomiej Piotrowski
6.0.x
Won't Fix
High
MOS Maintenance
6.1.x
Fix Released
High
Denis Meltsaykin

Bug Description

We have "delaycompress" option enabled in /etc/logrotate.conf globally.
This option orders logrotate to copytruncate the log and leave it renamed as <log file name>.1
Next time logrotate is started by cron - it compresses these <log file name>.1 first, removes the uncompressed source log and only after it starts new rotation cycle on the available logs. At least it is meant to be so

At the same time we have "sharedscripts" option enabled in /etc/logrotate.d/fuel.nodaily configuration file.
This option creates the big list of files to be rotated first and runs logrotate with the entire list instead of calling it against the each log file.

Having both these options at the same time leads to the following unwanted effects:

1. Looks like "sharedscripts" prevails over "delaycompress". So, when logrotate is started, it creates the list of files to rotate first instead of compressing the files, delayed from the previous rotation. As a results the delayed files are included to the rotation list. After that, logrotate attempts to start rotation ans stops completely on the first error like following:
#################################################
"error: error creating output file /var/log/docker-logs/mcollective.log.1: File exists"
#################################################
No rotation happens at all after such errors.

2. If error happened with any single log file rotation and "sharedscripts" is enabled - the remained logs are skipped from rotation as well.

Solution for the both cases is to not use "sharedscripts" option. Delaycompress may be necessary for some kinds of log sources, sharedscripts may be safely removed.

Note: this issue is better visible on the environments with a lot of log files - number of files increases the chance of logrotate failure.

++++++++++++++++++++++++++++++++++++++++++++++
Additional info on MOS version:

VERSION:
  feature_groups:
    - mirantis
  production: "docker"
  release: "7.0"
  openstack_version: "2015.1.0-7.0"
  api: "1.0"
  build_number: "187"
  build_id: "2015-08-18_03-05-20"
  nailgun_sha: "4710801a2f4a6d61d652f8f1e64215d9dde37d2e"
  python-fuelclient_sha: "4c74a60aa60c06c136d9197c7d09fa4f8c8e2863"
  fuel-agent_sha: "57145b1d8804389304cd04322ba0fb3dc9d30327"
  fuel-nailgun-agent_sha: "e01693992d7a0304d926b922b43f3b747c35964c"
  astute_sha: "e24ca066bf6160bc1e419aaa5d486cad1aaa937d"
  fuel-library_sha: "0062e69db17f8a63f85996039bdefa87aea498e1"
  fuel-ostf_sha: "17786b86b78e5b66d2b1c15500186648df10c63d"
  fuelmain_sha: "c9dad194e82a60bf33060eae635fff867116a9ce"

Changed in fuel:
assignee: Fuel Library Team (fuel-library) → Bartlomiej Piotrowski (bpiotrowski)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to fuel-library (master)

Fix proposed to branch: master
Review: https://review.openstack.org/215004

Changed in fuel:
status: New → In Progress
Revision history for this message
Bartłomiej Piotrowski (bpiotrowski) wrote :

Thanks for this incredibly detailed report, Miroslav, it was real pleasure to read it.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to fuel-library (master)

Reviewed: https://review.openstack.org/215004
Committed: https://git.openstack.org/cgit/stackforge/fuel-library/commit/?id=89ba68988a1fabed660e4de922c07159d0558bf9
Submitter: Jenkins
Branch: master

commit 89ba68988a1fabed660e4de922c07159d0558bf9
Author: Bartłomiej Piotrowski <email address hidden>
Date: Thu Aug 20 09:51:53 2015 +0200

    Remove sharedscripts from logrotate configuration

    Currently, both delaycompress and sharedscripts options are enabled.
    The first one causes logrotate to just rename matching files and
    compress them on next rotation, and the latter is supposed to make
    postrotate script run just once for all affected files.

    In practice, sharedscripts prevails over delaycompress, causing
    logrotate to include renamed uncompressed files to rotation list and
    eventually to fail due to filenames conflict, breaking entire rotation.

    The solution is deleting sharedscripts from our logrotate configuration
    files.

    Change-Id: I8a395834dc9fe40331a380e9af142fbadde4ea3b
    Closes-Bug: 1486690

Changed in fuel:
status: In Progress → Fix Committed
Revision history for this message
Vitaly Sedelnik (vsedelnik) wrote :

Won't Fix for 6.0-updated as there is no way to deliver Fuel fixes for 6.0.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to fuel-library (stable/6.1)

Fix proposed to branch: stable/6.1
Review: https://review.openstack.org/223074

Roman Rufanov (rrufanov)
tags: added: support
Igor (ipukha)
tags: added: on verification
Revision history for this message
Igor (ipukha) wrote :

Verified on MOS 7.0 ISO #296

Changed in fuel:
status: Fix Committed → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to fuel-library (stable/6.1)

Reviewed: https://review.openstack.org/223074
Committed: https://git.openstack.org/cgit/stackforge/fuel-library/commit/?id=f16775ee3a2645af628e0c6efad54332676c70d9
Submitter: Jenkins
Branch: stable/6.1

commit f16775ee3a2645af628e0c6efad54332676c70d9
Author: Bartłomiej Piotrowski <email address hidden>
Date: Thu Aug 20 09:51:53 2015 +0200

    Remove sharedscripts from logrotate configuration

    Currently, both delaycompress and sharedscripts options are enabled.
    The first one causes logrotate to just rename matching files and
    compress them on next rotation, and the latter is supposed to make
    postrotate script run just once for all affected files.

    In practice, sharedscripts prevails over delaycompress, causing
    logrotate to include renamed uncompressed files to rotation list and
    eventually to fail due to filenames conflict, breaking entire rotation.

    The solution is deleting sharedscripts from our logrotate configuration
    files.

    Change-Id: I8a395834dc9fe40331a380e9af142fbadde4ea3b
    Closes-Bug: 1486690
    (cherry picked from commit 89ba68988a1fabed660e4de922c07159d0558bf9)

Revision history for this message
Vitaly Sedelnik (vsedelnik) wrote :

Reassigned to Denis Meltsaykin to create release notes entry for MOS 6.1 MU 3

Revision history for this message
Alexander Bozhenko (alexbozhenko) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.