Chapter 3. Logging information for Red Hat Quay Obtaining log information using can be beneficial in various ways for managing, monitoring, and troubleshooting applications running in containers or pods. Some of the reasons why obtaining log information is valuable include the following: Debugging and Troubleshooting : Logs provide insights into what's happening inside the application, allowing developers and system administrators to identify and resolve issues. By analyzing log messages, one can identify errors, exceptions, warnings, or unexpected behavior that might occur during the application's execution. Performance Monitoring : Monitoring logs helps to track the performance of the application and its components. Monitoring metrics like response times, request rates, and resource utilization can help in optimizing and scaling the application to meet the demand. Security Analysis : Logs can be essential in auditing and detecting potential security breaches. By analyzing logs, suspicious activities, unauthorized access attempts, or any abnormal behavior can be identified, helping in detecting and responding to security threats. Tracking User Behavior : In some cases, logs can be used to track user activities and behavior. This is particularly important for applications that handle sensitive data, where tracking user actions can be useful for auditing and compliance purposes. Capacity Planning : Log data can be used to understand resource utilization patterns, which can aid in capacity planning. By analyzing logs, one can identify peak usage periods, anticipate resource needs, and optimize infrastructure accordingly. Error Analysis : When errors occur, logs can provide valuable context about what happened leading up to the error. This can help in understanding the root cause of the issue and facilitating the debugging process. Verification of Deployment : Logging during the deployment process can help verify if the application is starting correctly and if all components are functioning as expected. Continuous Integration/Continuous Deployment (CI/CD) : In CI/CD pipelines, logging is essential to capture build and deployment statuses, allowing teams to monitor the success or failure of each stage. 3.1. Obtaining log information for Red Hat Quay Log information can be obtained for all types of Red Hat Quay deployments, including geo-replication deployments, standalone deployments, and Operator deployments. Log information can also be obtained for mirrored repositories. It can help you troubleshoot authentication and authorization issues, and object storage issues. After you have obtained the necessary log information, you can search the Red Hat Knowledgebase for a solution, or file a support ticket with the Red Hat Support team. Use the following procedure to obtain logs for your Red Hat Quay deployment. Procedure If you are using the Red Hat Quay Operator on OpenShift Container Platform, enter the following command to view the logs: USD oc logs <quay_pod_name> If you are on a standalone Red Hat Quay deployment, enter the following command: USD podman logs <quay_container_name> Example output ... gunicorn-web stdout | 2023-01-20 15:41:52,071 [205] [DEBUG] [app] Starting request: urn:request:0d88de25-03b0-4cf9-b8bc-87f1ac099429 (/oauth2/azure/callback) {'X-Forwarded-For': '174.91.79.124'} ... 3.2. Examining verbose logs Red Hat Quay does not have verbose logs, however, with the following procedures, you can obtain a detailed status check of your database pod or container. Note Additional debugging information can be returned if you have deployed Red Hat Quay in one of the following ways: You have deployed Red Hat Quay by passing in the DEBUGLOG=true variable. You have deployed Red Hat Quay with LDAP authentication enabled by passing in the DEBUGLOG=true and USERS_DEBUG=1 variables. You have configured Red Hat Quay on OpenShift Container Platform by updating the QuayRegistry resource to include DEBUGLOG=true . For more information, see "Running Red Hat Quay in debug mode". Procedure Enter the following commands to examine verbose database logs. If you are using the Red Hat Quay Operator on OpenShift Container Platform, enter the following commands: USD oc logs <quay_pod_name> -- USD oc logs <quay_pod_name> -- -c <container_name> USD oc cp <quay_pod_name>:/var/lib/pgsql/data/userdata/log/* /path/to/desired_directory_on_host If you are using a standalone deployment of Red Hat Quay, enter the following commands: USD podman logs <quay_container_id> -- USD podman logs <quay_container_id> -- -c <container_name> USD podman cp <quay_container_id>:/var/lib/pgsql/data/userdata/log/* /path/to/desired_directory_on_host

Commands:
oc logs <quay_pod_name>
podman logs <quay_container_name>
gunicorn-web stdout | 2023-01-20 15:41:52,071 [205] [DEBUG] [app] Starting request: urn:request:0d88de25-03b0-4cf9-b8bc-87f1ac099429 (/oauth2/azure/callback) {'X-Forwarded-For': '174.91.79.124'}
oc logs <quay_pod_name> --previous
oc logs <quay_pod_name> --previous -c <container_name>
oc cp <quay_pod_name>:/var/lib/pgsql/data/userdata/log/* /path/to/desired_directory_on_host
podman logs <quay_container_id> --previous
podman logs <quay_container_id> --previous -c <container_name>
podman cp <quay_container_id>:/var/lib/pgsql/data/userdata/log/* /path/to/desired_directory_on_host