Bug 1382679 - [RFE] Change vdsm-logroate cron jobs definition
Summary: [RFE] Change vdsm-logroate cron jobs definition
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: vdsm
Classification: oVirt
Component: General
Version: 4.18.15
Hardware: Unspecified
OS: Unspecified
unspecified
low vote
Target Milestone: ---
: ---
Assignee: Yaniv Bronhaim
QA Contact: Pavel Stehlik
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-10-07 11:43 UTC by Jiri Belka
Modified: 2017-01-16 12:37 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-01-16 12:37:48 UTC
oVirt Team: Infra
ybronhei: ovirt-future?
rule-engine: planning_ack?
ybronhei: devel_ack+
rule-engine: testing_ack?


Attachments (Terms of Use)

Description Jiri Belka 2016-10-07 11:43:33 UTC
Description of problem:

IMO current state how vdsm-logrotate is called is bad:

- vdsm-logrotate is in /etc/cron.hourly

# ls -l /etc/cron.hourly/vdsm-logrotate 
-rwxr-xr-x. 1 root root 477 Sep 29 09:49 /etc/cron.hourly/vdsm-logrotate

- vdsm-logrotate in /etc/cron.hourly is called by:

# cat /etc/cron.d/0hourly 
# Run the hourly jobs
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
01 * * * * root run-parts /etc/cron.hourly

Thus, if one wants to change job interval - eg. every 10 mins as 1 hour makes couple of GB big log file - he is not able to do it in easy way:

1. /etc/cron.hourly/vdsm-logrotate if still exists it would be called again every hour (it could conflict with already running logrotate started with different interval)

2. if /etc/cron.hourly/vdsm-logrotate would be deleted, every rpm update would put it back (ie. we are back on '1.')

3. doing workaround about 1. + 2. is silly (ie. chmod a-x /etc/cron.hourly/vdsm-logrotate)

Thus a proposition:

1. new file in /etc/cron.d/ which would be just crontab-like file (calling vdsm-logrotate)
2. moving /etc/cron.hourly/vdsm-logrotate out of crond's dirs

This way a sysadmin could easy change eg /etc/cron.d/vdsm-logroate to run '*/10' minutes and this configuration would be preserved during updates.


Version-Release number of selected component (if applicable):
vdsm-4.18.15-1.el7ev.x86_64

How reproducible:
100%

Steps to Reproduce:
1. have easy way to define custom interval for vdsm-logrotate cron job
2. 
3.

Actual results:
not sysadmin friendly

Expected results:
see descr above

Additional info:

Comment 1 Jiri Belka 2016-10-07 11:53:46 UTC
Plus following seems to be doable directly in logrote configuration with 'postrotate':

~~~
#!/bin/sh

/usr/sbin/logrotate /etc/vdsm/logrotate/vdsm

EXITVALUE=$?
if [ $EXITVALUE != 0 ]; then
    /usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]"
fi

if [ -d /var/log/core ] ; then
    /usr/bin/find /var/log/core -type f -name '*xz' -mtime +7 -exec /bin/rm -f '{}' \;
    EXITVALUE=$?
    if [ $EXITVALUE != 0 ]; then
        /usr/bin/logger -t logrotate "ALERT clean old core files exited abnormally with [$EXITVALUE]"
    fi
fi

exit $EXITVALUE
~~~

Maybe an example:

~~~
...
           sharedscripts
           postrotate
               /usr/bin/find /var/log/core -type f -name '*xz' -mtime +7 -exec /bin/rm -f '{}' \;
           endscript
...
~~~

Comment 2 Jiri Belka 2016-10-07 11:55:20 UTC
Doesn't '-exec ...' is too expensive? Maybe pipe to xargs ?...

Comment 3 Oved Ourfali 2016-10-26 06:00:51 UTC
Yaniv - your thoughts here?

Comment 4 Yaniv Bronhaim 2016-10-27 15:42:32 UTC
Will be nice to take some actions in this area. we'll get into it for later release

Comment 5 Red Hat Bugzilla Rules Engine 2016-10-27 15:42:39 UTC
Bug tickets must have version flags set prior to targeting them to a release. Please ask maintainer to set the correct version flags and only then set the target milestone.

Comment 6 Nir Soffer 2016-11-02 07:09:49 UTC
1 hour of log create GB of log file? I never seen this.

Jiri, can you share an example log file?

I don't mind switching to  more sysadmin friendly configuration, but I don't see
how this is helpful.

Comment 7 Jiri Belka 2016-11-18 08:46:49 UTC
(In reply to Nir Soffer from comment #6)
> 1 hour of log create GB of log file? I never seen this.
> Jiri, can you share an example log file?

The content is not really relevant.

> 
> I don't mind switching to  more sysadmin friendly configuration, but I don't
> see
> how this is helpful.

Comment 8 Nir Soffer 2017-01-13 13:18:42 UTC
(In reply to Jiri Belka from comment #7)
> (In reply to Nir Soffer from comment #6)
> > 1 hour of log create GB of log file? I never seen this.
> > Jiri, can you share an example log file?
> 
> The content is not really relevant.

It is, vdsm should not produce so much log data, maybe you are using an older
version that spammed the log?

Please check with latest 4.0 or 4.1, and share with us one hour of debug log.

Comment 9 Jiri Belka 2017-01-13 13:57:49 UTC
(In reply to Nir Soffer from comment #8)
> (In reply to Jiri Belka from comment #7)
> > (In reply to Nir Soffer from comment #6)
> > > 1 hour of log create GB of log file? I never seen this.
> > > Jiri, can you share an example log file?
> > 
> > The content is not really relevant.
> 
> It is, vdsm should not produce so much log data, maybe you are using an older
> version that spammed the log?
> 
> Please check with latest 4.0 or 4.1, and share with us one hour of debug log.

feel free to close this, i'm not interested in this enhancement anymore.

Comment 10 Yaniv Bronhaim 2017-01-16 12:37:48 UTC
please re-open if required in any case. we need good reason to change the current behavior


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