Actions
Feature #27239
closedAdd timestamps to Foreman cron.log
Difficulty:
Triaged:
Yes
Bugzilla link:
Description
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 worked around 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
Actions