REGRESSSION: CentOS 7 log handling differs from 6 in a destructive way
|Assignee:||Javi Fontan||% Done:|
|Target version:||Release 5.0|
|Affected Versions:||Development, OpenNebula 4.12, OpenNebula 4.14|
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:
- Will have a permanent extension rather than the default 1,2...n sequence
- Will have an extension resembling the EL7 default " -%Y%m%d"
- Will not be destroyed by or prevent a second restart/rotation in the same day