The proposal
Foreman has been logging to /var/log/foreman/production.log
(and smart proxy to /var/log/foreman-proxy/proxy.log
) for as long as I can remember. In the mean time, the world has moved a bit, all officially supported platforms(*1) now have systemd, containers are on the rise and one could say logging into files is becoming a thing of the past. My proposal would be to move away from it where possible and either log to journal directly or just log to stdout and then have systemd (or the container runtime) collect it. As far as I know all the bits and pieces are already there, we would “just” need to change the default configuration.
This proposal shares some points with https://community.theforeman.org/t/default-logging-in-foreman-file-syslog-or-journald but focuses on journald or stdout instead of journald or syslog.
Benefits of logging to stdout + journal
We would not have to care about logrotate. It would also completely prevent a certain class of bugs from happening (processes logging into rotated files).
Currently, both Foreman (the web application), dynflow-sidekiq workers and various rake tasks triggered from cron or manually log into the same file without any indication, making it hard to guess where parts of logs come from. This could be taken even further by turning our cron jobs into systemd timers, but that’s a topic for another RFC.
One would be able to collect logs with timestamps recalculated to an arbitrary timezone.
Once we move away from logging to files, we’d be just a step away from doing structured logging (available since Foreman 1.18) as described in the post linked above.
Disadvantages
While the change to make it happen could be somewhat small, it would additionally have to be reflected in the docs, debugging and support tools would have to be updated and it would probably take some time until people would get used to the new way of interacting with logs.
We may need start putting some journald configuration drop-ins in place to ensure logs are persisted for long enough.
*1 Yes, I know there are packages for FreeBSD and deb packages could be possibly used on devuan but it is not officially supported