Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1113264 - Incorrect usage of logrotate leads to using two different settings
Summary: Incorrect usage of logrotate leads to using two different settings
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: vdsm
Version: 3.4.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: 3.5.0
Assignee: Yaniv Bronhaim
QA Contact: Jiri Belka
URL:
Whiteboard: infra
Depends On:
Blocks: 1126482 rhev3.5beta 1156165
TreeView+ depends on / blocked
 
Reported: 2014-06-25 19:28 UTC by Alon Bar-Lev
Modified: 2016-02-10 19:22 UTC (History)
10 users (show)

Fixed In Version: vt2.2
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1126482 (view as bug list)
Environment:
Last Closed: 2015-02-16 13:38:40 UTC
oVirt Team: Infra
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
oVirt gerrit 29624 master MERGED Moving vdsm-logrotate config under vdsm conf dir Never
oVirt gerrit 30729 ovirt-3.5 MERGED Moving vdsm-logrotate config under vdsm conf dir Never
oVirt gerrit 31106 ovirt-3.4 MERGED Moving vdsm-logrotate config under vdsm conf dir Never

Description Alon Bar-Lev 2014-06-25 19:28:48 UTC
Thanks to Marina to brining this up!

vdsm installs:

/etc/cron.hourly/vdsm-logrotate
---
/usr/sbin/logrotate /etc/logrotate.d/vdsm
---

And of course: /etc/logrotate.d/vdsm

The outcome is that daily run of logrotate, runs a logrotate instance with /etc/logrotate.conf which handles /etc/logrotate.d/vdsm within its configuration context.

And... the vdsm cron that runs logrotate with /etc/logrotate.d/vdsm ignoring the system configuration.

This is invalid usage of logrotate, as one should choose which configuration to run.

Options:

[SIMPLE, LESS RECOMMENDED]
1. Move /etc/logrotate.d/vdsm to /etc/vdsm/logrotate/vdsm, and modify cron script to use this specific configuration. This way the system logrotate will not handle vdsm logs.

2. Execute hourly /etc/cron.daily/logrotate instead of daily, regardless of vdsm, and drop the explicit logrotation of vdsm, also recommended to add minsize XXX and daily into logrotate, to avoid rotation without reason.

The side effect is that other logs will be rotated in higher interval if actually needed by their configuration.

Comment 1 Dan Kenigsberg 2014-06-26 08:20:26 UTC
Could you explain why option 2, with its wider system-wide effects, is more recommended? All we want to do is stop the effect of logrotate.conf on vdsm, and moving /etc/logrotate.d/vdsm away does just that.

An even simpler fix would be to add an explicit 'nodateext' to /etc/logrotate.d/vdsm, which would force "normal" extension to vdsm.log even when executed via /etc/logrotate.conf. This would keep the ugly race between the hourly and the daily runs, but would make them unnoticeable again.

Comment 2 Dan Kenigsberg 2014-06-26 08:25:51 UTC
oh, and if "minsize" is to replace "size" in the conf, please test it thoroughly. I recall that it had non-intuitive semantics.

Comment 3 Alon Bar-Lev 2014-06-26 08:27:32 UTC
(In reply to Dan Kenigsberg from comment #1)
> Could you explain why option 2, with its wider system-wide effects, is more
> recommended? All we want to do is stop the effect of logrotate.conf on vdsm,
> and moving /etc/logrotate.d/vdsm away does just that.

you should not override sysadmin preferences.
it is up to component to provide logrotate configuration.
it is up to sysadmin to decide where/when/how it will be used.
any change in /etc/logrotate.conf is expected to effect the entire logrotation of the system.

> An even simpler fix would be to add an explicit 'nodateext' to
> /etc/logrotate.d/vdsm, which would force "normal" extension to vdsm.log even
> when executed via /etc/logrotate.conf. This would keep the ugly race between
> the hourly and the daily runs, but would make them unnoticeable again.

see above. if you use logrotate and also install it so that the system logrotation picks it up, you do not override the system setting just for fun.

either create your custom rotation move it out from the system logrotation configuration, you can use logrotate or any other custom program you may like. this is bad practice as sysadmin that is not aware of your inventions is incapable of managing his system using best practices.

or use the logrotate as expected.

Comment 4 Dan Kenigsberg 2014-06-26 12:09:08 UTC
(In reply to Alon Bar-Lev from comment #3)
> 
> you should not override sysadmin preferences.

I thought that your option 2 was about doing just that (making the system logrotate run every hour). imo your option 1 is precise and favorable.

Comment 5 Alon Bar-Lev 2014-06-26 12:22:54 UTC
(In reply to Dan Kenigsberg from comment #4)
> (In reply to Alon Bar-Lev from comment #3)
> > 
> > you should not override sysadmin preferences.
> 
> I thought that your option 2 was about doing just that (making the system
> logrotate run every hour). imo your option 1 is precise and favorable.

making logrotate run every hour should not have negative effect if run without force, logrotate is designed to be run also at different intervals. in ovirt-engine we did not modify the logrotate scheduling, but suggest to add it to hourly or higher if the system is loaded.

Comment 6 Dan Kenigsberg 2014-07-25 14:03:50 UTC
Please backport to the ovirt-3.5 branch - it is a 3.5.0 bug.

Comment 9 Jiri Belka 2014-09-05 12:36:47 UTC
ok, vdsm-4.16.3-2.el6.x86_64

changed to 50k to see if it works.

[root@dell-r210ii-04 yum.repos.d]# ls -l /etc/vdsm/logrotate/vdsm /etc/cron.hourly/vdsm-logrotate 
-rwxr-xr-x. 1 root root 484 Sep  5 14:23 /etc/cron.hourly/vdsm-logrotate
-rw-r--r--. 1 root root 315 Sep  5 14:34 /etc/vdsm/logrotate/vdsm
[root@dell-r210ii-04 yum.repos.d]# ls -l /var/log/vdsm/
total 100
drwxr-xr-x. 2 vdsm kvm   4096 Sep  2 18:04 backup
-rw-r--r--. 1 vdsm kvm    475 Sep  5 13:44 connectivity.log
-rw-r--r--. 1 vdsm kvm   1037 Sep  5 13:45 mom.log
-rw-r--r--. 1 root root 24514 Sep  5 13:49 supervdsm.log
-rw-r--r--. 1 root root  4731 Sep  5 13:44 upgrade.log
-rw-r--r--. 1 vdsm kvm  48458 Sep  5 14:35 vdsm.log
-rw-r--r--. 1 vdsm kvm   7556 Sep  5 14:34 vdsm.log.1.xz


Note You need to log in before you can comment on or make changes to this bug.