Este conteúdo não está disponível no idioma selecionado.
Chapter 3. Logging information for Red Hat Quay
To troubleshoot, monitor, and secure your {product-title} deployment, you can use log information from containers and pods. Logs support debugging, performance monitoring, security analysis, capacity planning, and deployment verification.
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 Copiar o linkLink copiado para a área de transferência!
To obtain log information for your {product-title} deployment and troubleshoot authentication, authorization, or object storage issues, you can use oc logs for Operator deployments or podman logs for standalone deployments. You can then search the Red Hat Knowledgebase or file a support ticket.
Procedure
If you are using the Red Hat Quay Operator on OpenShift Container Platform, enter the following command to view the logs:
oc logs <quay_pod_name>
$ oc logs <quay_pod_name>Copy to Clipboard Copied! Toggle word wrap Toggle overflow If you are on a standalone Red Hat Quay deployment, enter the following command:
podman logs <quay_container_name>
$ podman logs <quay_container_name>Copy to Clipboard Copied! Toggle word wrap Toggle overflow 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'} ...... 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'} ...Copy to Clipboard Copied! Toggle word wrap Toggle overflow
3.2. Examining verbose logs Copiar o linkLink copiado para a área de transferência!
To get a detailed status check of your {product-title} database pod or container, you can use oc logs or podman logs with --previous and copy PostgreSQL logs with oc cp or podman cp. Enable DEBUGLOG=true for additional debugging information.
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=truevariable. -
You have deployed Red Hat Quay with LDAP authentication enabled by passing in the
DEBUGLOG=trueandUSERS_DEBUG=1variables. -
You have configured Red Hat Quay on OpenShift Container Platform by updating the
QuayRegistryresource to includeDEBUGLOG=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:
oc logs <quay_pod_name> --previous
$ oc logs <quay_pod_name> --previousCopy to Clipboard Copied! Toggle word wrap Toggle overflow oc logs <quay_pod_name> --previous -c <container_name>
$ oc logs <quay_pod_name> --previous -c <container_name>Copy to Clipboard Copied! Toggle word wrap Toggle overflow oc cp <quay_pod_name>:/var/lib/pgsql/data/userdata/log/* /path/to/desired_directory_on_host
$ oc cp <quay_pod_name>:/var/lib/pgsql/data/userdata/log/* /path/to/desired_directory_on_hostCopy to Clipboard Copied! Toggle word wrap Toggle overflow If you are using a standalone deployment of Red Hat Quay, enter the following commands:
podman logs <quay_container_id> --previous
$ podman logs <quay_container_id> --previousCopy to Clipboard Copied! Toggle word wrap Toggle overflow podman logs <quay_container_id> --previous -c <container_name>
$ podman logs <quay_container_id> --previous -c <container_name>Copy to Clipboard Copied! Toggle word wrap Toggle overflow podman cp <quay_container_id>:/var/lib/pgsql/data/userdata/log/* /path/to/desired_directory_on_host
$ podman cp <quay_container_id>:/var/lib/pgsql/data/userdata/log/* /path/to/desired_directory_on_hostCopy to Clipboard Copied! Toggle word wrap Toggle overflow