Fixes #365 - Add tail command to show recent service logs#430
Fixes #365 - Add tail command to show recent service logs#430jakduch wants to merge 1 commit intotheforeman:masterfrom
Conversation
Add a new foremanctl tail command as an alternative to foreman-tail. It uses journalctl to show recent logs from all Foreman services (foreman, dynflow, pulp, candlepin, httpd, redis, postgresql). Supports --service to filter specific services and --lines to control how many recent lines to display (default 50). Only services that are actually running are included in the output.
|
Does it support |
|
Not yet — follow mode ( We could add |
| vars: | ||
| services: [] | ||
| lines: 50 | ||
| all_services: |
There was a problem hiding this comment.
There is a trend of listing services. Something to think about is whether this means we should put them in centralized location.
| - redis | ||
| - postgresql | ||
| tasks: | ||
| - name: Gather service facts |
No pattern for streaming output. As mentioned, this is not something Ansible does. Can you paste example output of the command as is? This begs the question is foremanctl the right tool for the job? One of our design paradigms is to embrace the core system libraries for handling things (e.g. systemd, journald). Can we define configuration on the system that makes interacting with journald for our services easier? |
|
You're right - I was trying to avoid changing the underlying infrastructure and just wrapped the existing services in an Ansible playbook. But that goes against the design principle of embracing systemd/journald. Since all Foreman services are already registered under This gives both recent logs and follow mode for free, without foremanctl needing to manage it. The only thing missing is discoverability - users might not know about We could address that by documenting it (e.g. in Happy to close this PR if you think the native journald approach is sufficient. Or should I rework it here to use the |
Adds a new
foremanctl tailcommand as an alternative to theforeman-tailtool from foreman-installer based installations.Uses journalctl to collect and display recent logs from all Foreman services. Only services that are actually running on the system are included in the output.
Usage:
foremanctl tail— show last 50 lines from all servicesforemanctl tail --lines 200— show last 200 linesforemanctl tail --service foreman --service pulp-api— filter specific servicesServices covered: foreman, dynflow-sidekiq (orchestrator, worker, worker-hosts-queue), pulp-api, pulp-content, candlepin, httpd, redis, postgresql