[Satellite6] How to dump queries to pulp or candlepin from katello?
Environment
Red Hat Satellite 6.2 or newer
Issue
- need to understand what particular
pulporcandlepinqueries are made bykatello/foreman - how to get those debugs to a logfile?
Resolution
Enable selective logging for foreman for pulp_rest:
- in
/etc/foreman/settings.yaml, setdebuglogging level (by moving the:level: line into the scope ofproduction:) and addpulp_rest(for pulp) orcp_rest(for candlepin) into:loggers:section like below:
# Log settings for the current environment can be adjusted by adding them
# here. For example, if you want to increase the log level.
:logging:
:production:
:level: debug
# Individual logging types can be toggled on/off here
:loggers:
pulp_rest:
enabled: true
cp_rest:
enabled: true
- apply the change by restarting proper services:
systemctl restart foreman.service dynflow-sidekiq@*.service
-
perform an action (i.e. enable repo, sync it, publish a Content View, get details of a package,..) that invokes a
pulpquery orcandlepinquery (e.g. runsubscription-manager refreshon a client) -
check
/var/log/foreman/production.logfor the query details like in below "get a package detail" action (forpulpquery here):
2017-04-13 14:38:10 [app] [I] Processing by Katello::Api::V2::PackagesController#show as JSON
2017-04-13 14:38:10 [app] [I] Parameters: {"api_version"=>"v2", "id"=>"3713640f-9345-4fb7-9106-d8c527afef7f"}
2017-04-13 14:38:11 [katello/pulp_rest] [D] RestClient.post "https://satellite.example.com/pulp/api/v2/content/units/rpm/search/", "{\"criteria\":{\"filters\":{\"_id\":{\"$in\":[\"3713640f-9345-4fb7-9106-d8c527afef7f\"]}}},\"include_repos\":true}", "Accept"=>"*/*; q=0.5, application/xml", "Accept-Encoding"=>"gzip, deflate", "Content-Length"=>"102", "accept"=>"application/json", "content_type"=>"application/json"
| \n# => 200 OK | application/json 8819 bytes
|
2017-04-13 14:38:11 [app] [I] Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.94/app/views/katello/api/v2/packages/show.json.rabl within katello/api/v2/layouts/resource (837.6ms)
2017-04-13 14:38:11 [app] [I] Completed 200 OK in 850ms (Views: 839.8ms | ActiveRecord: 3.9ms)
Be aware that not all details are printed, see This content is not included.This content is not included.https://bugzilla.redhat.com/show_bug.cgi?id=1494816 for more.
For more KB articles/solutions related to Red Hat Satellite 6.x Pulp 2.0 Issues, please refer to the Consolidated Troubleshooting Article for Red Hat Satellite 6.x Pulp 2.0-related Issues
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.