Bug #4365

REGRESSSION: CentOS 7 log handling differs from 6 in a destructive way

Added by Bill Cole over 5 years ago. Updated about 5 years ago.

Status:ClosedStart date:03/03/2016
Priority:NormalDue date:
Assignee:Javi Fontan% Done:

100%

Category:Packaging
Target version:Release 5.0
Resolution:fixed Pull request:
Affected Versions:Development, OpenNebula 4.12, OpenNebula 4.14

Description

In CentOS 6 the opennebula init script calls bin/one (itself structured much like an init script) which by default moves any existing oned.log, one_xmlrpc.log, and sched.log to timestamped names before starting bin/oned and bin/mm_sched

In CentOS 7 the SystemD service files start bin/oned and bin/mm_sched directly, without the intermediate script. This causes the destruction of any current logs.

The ideal solution to this would simply be to correct the long-standing design flaw in oned and mm_sched of clobbering existing logs instead of appending to them. Issues opened in the past asking for that have been closed as wontfix, which leads me to believe that it is hopeless to ask for that change. It would also be useful if they would respond (as so many daemons do) to a SIGHUP by re-initializing (i.e. reloading their config files and closing/re-opening log files.)

An ugly but functional alternative that doesn't require modifying the daemons to behave sensibly:

Add this line to opennebula.service after the other ExecStartPre lines:

ExecStartPre=/sbin/logrotate -s /tmp/logrotate.state  -f /etc/logrotate.d/opennebula

Add these 3 lines to the top of /etc/logrotate.d/opennebula:

delaycompress
dateext
dateformat -%Y%m%d-%s

The 'dateformat' is that ugly mess so that rotated logs:

  1. Will have a permanent extension rather than the default 1,2...n sequence
  2. Will have an extension resembling the EL7 default " -%Y%m%d"
  3. Will not be destroyed by or prevent a second restart/rotation in the same day

Associated revisions

Revision 50fb192e
Added by Javi Fontan about 5 years ago

bug #4365: rotate logs on oned or sunstone start

Sent by: Bill Cole

Revision 0b91e938
Added by Javi Fontan about 5 years ago

bug #4365: fix path in logrotate call

History

#1 Updated by Ruben S. Montero over 5 years ago

  • Category set to Packaging
  • Target version set to Release 5.0

#2 Updated by Javi Fontan about 5 years ago

  • Assignee set to Javi Fontan

#3 Updated by Javi Fontan about 5 years ago

  • % Done changed from 0 to 50
  • Affected Versions Development added

I've added your logrotate changes and modified systemd scripts to use them. Both opennebula and opennebula-sunstone. We will check that everything runs as expected in the next testing cycle.

#4 Updated by Javi Fontan about 5 years ago

  • Status changed from Pending to Closed
  • Resolution set to fixed

#5 Updated by Javi Fontan about 5 years ago

  • % Done changed from 50 to 100

Also available in: Atom PDF