Project

General

Profile

Actions

Feature #27239

closed

Add timestamps to Foreman cron.log

Added by William Clark over 5 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Target version:
-
Fixed in Releases:
Found in Releases:

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.

  1. 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

Also available in: Atom PDF