Skip to content

Route Candlepin logs to journald via stdout#625

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

Route Candlepin logs to journald via stdout#625
Alleny244 wants to merge 1 commit into
theforeman:masterfrom
Alleny244:fix/candlepin-journal-logging

Conversation

@Alleny244

Copy link
Copy Markdown
Contributor

Why are you introducing these changes?

Candlepin runs as a Podman container but currently writes application and Tomcat logs to host-mounted directories under /var/log/candlepin and /var/log/tomcat. This does not align with the containerized logging model, where services should log to stdout/stderr and rely on journald.

This change switches Candlepin, Tomcat, and HTTP access logging to stdout so all logs are collected by journald.

Related: Logging audit for journal-only deployments.


What are the changes introduced in this pull request?

  • Add logback.xml template using ConsoleAppender for Candlepin application logs.
  • Add logging.properties template using ConsoleHandler for Tomcat internal logs.
  • Mount both configuration files as Podman secrets.
  • Remove host log volume mounts (/var/log/candlepin and /var/log/tomcat) and the task creating those directories.
  • Add a Tomcat AccessLogValve to write HTTP access logs to stdout.
  • Add integration tests to verify:
    • Candlepin logs are written to the journal.
    • Log volume mounts are no longer present.

How to test this pull request

  1. Deploy foremanctl from this branch.
  2. Verify Candlepin is running:
    curl -sk https://localhost:23443/candlepin/status
    systemctl is-active candlepin
  3. Generate a request and verify logs appear in the journal:
    curl -sk https://localhost:23443/candlepin/status
    sudo journalctl -u candlepin --since "1 min ago" --no-pager
  4. Confirm the container no longer mounts /var/log/candlepin or /var/log/tomcat:
    sudo podman inspect candlepin --format '{{range .Mounts}}{{.Destination}} {{end}}'
  5. Verify the old log files are no longer updated.
  6. Run the new integration tests.

Checklist

  • Tests added/updated

Comment thread tests/candlepin_test.py
assert 'LoggingFilter' in journal.stdout


def test_candlepin_no_log_volume_mounts(server):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this test is necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants