Skip to content

Send httpd vhost logs to journald via systemd-cat#624

Open
Alleny244 wants to merge 1 commit into
theforeman:masterfrom
Alleny244:fix/httpd-journal-logging
Open

Send httpd vhost logs to journald via systemd-cat#624
Alleny244 wants to merge 1 commit into
theforeman:masterfrom
Alleny244:fix/httpd-journal-logging

Conversation

@Alleny244

Copy link
Copy Markdown
Contributor

Why are you introducing these changes?

foremanctl deploys httpd as a host service, but the Foreman vhosts currently write access and error logs to files under /var/log/httpd/. This does not align with the containerized logging model, where logs should be written to stdout/stderr and collected by journald.

On EL9, logging directly to /dev/stdout was unreliable under systemd. Using systemd-cat with dedicated journal tags provides reliable integration with journald.


What are the changes introduced in this pull request?

  • Update foreman-vhost.conf.j2 and foreman-ssl-vhost.conf.j2 to pipe access and error logs through systemd-cat instead of writing to /var/log/httpd/.
  • Add integration tests to verify:
    • vhost configuration uses systemd-cat
    • HTTPS access logs are written to the system journal

How to test this pull request

  1. Deploy foremanctl from this branch.
  2. Verify the generated Apache configuration uses systemd-cat:
    grep -E 'ErrorLog|CustomLog' /etc/httpd/conf.d/foreman-ssl.conf
  3. Generate an HTTPS request:
    curl -sk https://localhost/api/v2/ping
  4. Confirm the request appears in the journal:
    sudo journalctl -t httpd-ssl-access --since "1 min ago" --no-pager
  5. Verify the old log files under /var/log/httpd/ are no longer being updated.
  6. Run the new integration tests.

Checklist

  • Tests added/updated

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant