Bug 1716314

Summary: foreman cron.log should contain timestamp
Product: Red Hat Satellite Reporter: Steffen Froemer <sfroemer>
Component: PackagingAssignee: wclark
Status: CLOSED ERRATA QA Contact: Lukas Pramuk <lpramuk>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.5.0CC: dchaudha, ehelms, inecas, wclark, zhunting
Target Milestone: 6.10.0Keywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-11-16 14:08:28 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Steffen Froemer 2019-06-03 08:18:23 UTC
Description of problem:
For better readability, the /var/log/foreman/cron.log should contain a valid timestamp

Version-Release number of selected component (if applicable):
foreman-1.20.1.34-1.el7sat.noarch

How reproducible:
always

Steps to Reproduce:
1. su - foreman -s /bin/bash
2. run an example command from /etc/cron.d/foreman

  $ /usr/sbin/foreman-rake notifications:clean >>/var/log/foreman/cron.log 2>&1


Actual results:
Starting expired notifications clean up...
Finished, cleaned 0 notifications



Expected results:
[2019-06-03 10:15:52] Starting expired notifications clean up...
[2019-06-03 10:15:52] Finished, cleaned 0 notifications


Additional info:
As foreman-rake does not provide timestamp, it could be workarounded by adding an additional command to crontab

e.g.

# Clean expired notifications
0 6 * * 0       foreman    /usr/sbin/foreman-rake notifications:clean | gawk '{ print strftime("[%Y-%m-%d %H:%M:%S]"), $0 }' >>/var/log/foreman/cron.log 2>&1

Comment 3 wclark 2019-07-04 13:40:59 UTC
Created Redmine

Comment 4 Bryan Kearney 2019-11-05 20:46:41 UTC
Upstream bug assigned to wclark

Comment 5 Bryan Kearney 2020-11-05 20:02:44 UTC
Upstream bug assigned to wclark

Comment 6 Bryan Kearney 2020-11-05 20:02:47 UTC
Upstream bug assigned to wclark

Comment 7 Bryan Kearney 2020-11-11 16:02:37 UTC
Upstream bug assigned to wclark

Comment 8 Bryan Kearney 2020-11-11 16:02:39 UTC
Upstream bug assigned to wclark

Comment 9 Bryan Kearney 2020-11-16 16:02:49 UTC
Upstream bug assigned to wclark

Comment 10 Bryan Kearney 2020-11-16 16:02:51 UTC
Upstream bug assigned to wclark

Comment 11 Bryan Kearney 2021-03-12 08:03:24 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/27239 has been resolved.

Comment 12 Lukas Pramuk 2021-07-27 19:49:11 UTC
VERIFIED.

@Satellite 6.10.0 Snap10.0
foreman-2.5.2-1.el7sat.noarch

by the following manual command:

# tail /var/log/foreman/cron.log
[2021-07-27 14:30:17] 'ErbParser' is ignored.
[2021-07-27 14:30:17] 'RubyParser' is ignored.
[2021-07-27 15:00:03] `/usr/share/foreman` is not writable.
[2021-07-27 15:00:03] Bundler will use `/tmp/bundler20210727-65313-g1dxc965313' as your home directory temporarily.
[2021-07-27 15:00:16] 'ErbParser' is ignored.
[2021-07-27 15:00:16] 'RubyParser' is ignored.
[2021-07-27 15:30:04] `/usr/share/foreman` is not writable.
[2021-07-27 15:30:04] Bundler will use `/tmp/bundler20210727-65657-hq8muq65657' as your home directory temporarily.
[2021-07-27 15:30:17] 'ErbParser' is ignored.
[2021-07-27 15:30:17] 'RubyParser' is ignored.

>>> /var/log/foreman/cron.log now contains only entries with timestamp

Comment 15 errata-xmlrpc 2021-11-16 14:08:28 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: Satellite 6.10 Release), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2021:4702