Container logs#
Container logs provide records of activity on the internal components of Package Security Manager—activity like incoming requests, errors, and configuration changes. Checking these logs can help you troubleshoot specific problems with your instance. Logs also give you a clearer picture of how your containers interact with each other. Below is a brief description of each container in the application, and what information you can gain from reviewing the logs for that container.
Container name |
Description |
Use case |
---|---|---|
|
The |
Monitor routing decisions, load balancing actions, errors during proxying, and buffering behavior. Includes connection details, such as IP addresses used and handling of slow client connections. |
|
The |
Use these logs to diagnose active connections, HTTP requests, and errors related to metric scraping. |
|
If your setup has a dedicated proxy container separate from the |
Logs incoming and outgoing requests, records HTTP status codes, URLs, client IP addresses, and identifies network-related errors such as failed connections, timeouts, or DNS issues. |
|
The |
Monitor login attempts, token issuances, and any errors related to identity management or user account configuration. |
|
The |
Review these logs for errors in configuration files or loading of new settings. If you see repeated reload attempts, investigate potential misconfigurations. |
|
Logs from the |
Find status codes, endpoint usage stats, and application-level errors. Monitoring these logs helps you diagnose failing API calls or performance slowdowns. |
|
The |
If a migration fails, these logs can pinpoint the exact database operation or script that caused the issue. |
|
The |
Monitor details on job dispatching, event handling, and Prometheus metrics, with security requirements for internal access only |
|
The |
These logs relate to job scheduling, event dispatching, and the outcome of triggered processes. |
|
|
These logs show database queries, connection attempts, transaction processes, and any errors or warnings related to database integrity and performance, particularly during upgrades or backups. Check these logs if you’re tracking database performance or investigating query timeouts. |
|
The |
Monitor database performance details for metrics collection, export status, connection attempts to the PostgreSQL database, and any encountered errors during metrics scraping, helping to |
|
The |
Use these logs to track ephemeral key usage, detect potential memory leaks, and troubleshoot connection issues. |
|
The |
Provides metrics on cache performance, hit/miss ratios, and memory usage. Essential for monitoring Redis health and performance. Review these metrics to optimize your caching strategy and forecast resource needs. |
|
The |
Logs metric collection, storage details, and alerting rules. Important for ensuring accurate and timely monitoring data. Review these logs if your metrics aren’t updating as expected or alerts fail to trigger. Check for error messages or slow scrape warnings. |
|
The |
These logs provide metrics on system resources like CPU, memory, and disk usage. Check for messages about missing permissions or inaccessible system files. |
Viewing containers#
Follow these steps to view the containers in your Package Security Manager instance:
Open a terminal and connect to your instance of Package Security Manager.
Run the following command:
docker ps --all
Viewing container logs#
Follow these steps to view the logs for a specific container:
Open a terminal and connect to your instance of Package Security Manager.
Run the following command:
# Replace <CONTAINER_NAME> with the name of the container docker logs <CONTAINER_NAME>
For example:
docker logs keycloak
Tip
You can also view container logs in real-time by adding the
--follow
option to your command:# Replace <CONTAINER_NAME> with the name of the container docker logs --follow <CONTAINER_NAME>
Viewing logs in real time allows you to monitor ongoing processes and catch issues as they occur. This is particularly useful during deployments or troubleshooting sessions.
Analyzing container logs#
Container logs hold various types of information that can help you understand the behavior and performance of your containers, enabling you troubleshoot and maintain your Package Security Manager instance effectively.
Container logs typically capture the following important details:
Log Information |
Description |
---|---|
Timestamps |
Each log entry includes a timestamp, which tracks when specific events occurred, making it easier to correlate container logs with other system activities. Docker and Podman both support adding timestamps to log output using the |
Log levels |
Applications inside containers typically categorize logs by severity, such as INFO, DEBUG, WARNING, ERROR, or FATAL. These levels help prioritize which logs need immediate attention. While container runtimes don’t enforce log levels, most applications generate logs with different severity levels. |
Error messages |
Critical issues or failures during container operations are captured in error messages. These messages include information like stack traces or system-generated errors, offering additional context for troubleshooting. Containers running services like web servers or databases log these issues via STDERR. |
Process information |
Logs often capture details about the processes running inside the container, such as when services start, stop, or encounter issues. This information is helpful for understanding the container’s operational state. |
Log routing |
Some applications running inside containers may log directly to files instead of using standard output (STDOUT) or standard error (STDERR). In such cases, you can redirect log files to STDOUT/STDERR. For example, in Docker, this is done using symbolic links (as with the official Nginx image), or by configuring applications to log directly to the appropriate file descriptors. |
Exporting logs#
Save the logs for a specific container by running the following command:
# Replace <CONTAINER_NAME> with the name of the container you are viewing
# Replace <FILE_NAME> with the name of the file you are saving
docker logs <CONTAINER_NAME> > <FILE_NAME>.log
Alternatively, you can collect and save logs for all the containers at once by running the following commands:
# Replace <LOG_FILE_PREFIX> with a prefix for all of your log files (e.g., logs_dump) # Replace <CONTAINER_LOGS_DUMP> with a name for the tarball file that contains all the logs for x in $(sudo docker ps --format '{{.Names}}'); do sudo docker logs $x >& <LOG_FILE_PREFIX>_$x; done tar cvjf <CONTAINER_LOGS_DUMP>.tar.bz2 <LOG_FILE_PREFIX>_*
Integrating logs with monitoring tools#
Use monitoring tools like Grafana and Prometheus to visualize container performance trends and set up alerts for issues in your Package Security Manager instance. Grafana helps you spot anomalies, while Prometheus allows you to create alerts based on error rates.
For more information on accessing your dashboards and monitoring the health of your Package Security Manager instance, see Grafana monitoring.
To learn more about Prometheus and metrics collection, see System metrics with Prometheus.
To configure your logs to be sent directly to AWS CloudWatch, see the official AWS CloudWatch Logs documentation for detailed instructions.