quattor / CCM

Configuration Cache Manager
www.quattor.org
Other
4 stars 13 forks source link

ccm-fetch cronjob does not log timestamp #121

Closed ned21 closed 8 years ago

ned21 commented 8 years ago
# cat /etc/cron.d/ccm-fetch.cron
# run regularly ccm-fetch. To avoid lost notifications
#

0 * * * * root (perl -e 'sleep rand 3600'; /usr/sbin/ccm-fetch) >>/var/log/ccm-fetch.log 2>&1

leaves a useful log file in /var/log/ccm-fetch.log but it contains no timestamp. Normally this is not an issue because the timestamp can be inferred from the times in /var/lib/ccm but a timestamp is required when trying to work out why a profile was not downloaded.

stdweird commented 8 years ago

i'd propose to change it to

# run regularly ccm-fetch. To avoid lost notifications
#
RANDOM_DELAY=45
0 * * * * root (date --iso-8601=seconds --utc; /usr/sbin/ccm-fetch) >>/var/log/ccm-fetch.log 2>&1

random_delay (in minutes) should be supported in all/most cron versions; and it's better than the dangling perl sleep process on all our nodes.

(or did you want a timestamp in on each output line?)

ned21 commented 8 years ago

+1 for RANDOM_DELAY, although why 45 and not 60?

On Solaris we ship this via templates rather than pkg. Perhaps we should just move it to templates on Linux too?

         nlist("name", "ccm-fetch",
                "user", "root",
                "timing", nlist("minute", "0", "smear", 59),
                "command", "/sbin/ccm-fetch",
ttyS4 commented 8 years ago

ncm-ncd logs to syslog why this is not the case for ccm-fetch? If it would then the lack of timestamps on stdout won't be an issue.

stdweird commented 8 years ago

because CAF::Reporter isn't exactly the nicest report/log framework around? the easiest way to have ccm report to syslog is to have it log to a logfile. any objections against logging to /var/log/ccm-fetch.log? (and similar for ccm-initialize/purge). or only log to syslog?

ttyS4 commented 8 years ago

@stdweird if that is how we can achieve it then sounds fine to me.