How to rotate log files of Quay containers?
Environment
- Red Hat Quay
- 3.x
Issue
- The
logrotateconfigurations for nginx were found inside the quay image but it seems like the log rotation does not work. - How can one configure log rotation for quay container files? Can one use the parameter
FEATURE_ACTION_LOG_ROTATION?
Resolution
-
Quay containers do not have a logrotate binary. nginx logs are forwarded to
/dev/stdoutby default. And are governed by the container runtime one is using. -
The FEATURE_ACTION_LOG_ROTATION concerns
audit logsstored in Quay's database under the logrotate3 table. It can't be used to rotate container logs.
Diagnostic Steps
-
Check if
logrotate rpmcomes with quay image using below steps:$ podman run --rm -it --entrypoint /bin/bash registry.redhat.io/quay/quay-rhel8:v3.7.6 Unable to find image 'registry.redhat.io/quay/quay-rhel8:v3.7.6' locally v3.7.6: Pulling from quay/quay-rhel8 db0f4cd41250: Already exists 7e3624512448: Already exists 60344cf5b4de: Pull complete Digest: sha256:52eed9bdf493a8bef6f0dc2c582357aa708ccee2116f9013263adcd1db464003 Status: Downloaded newer image for registry.redhat.io/quay/quay-rhel8:v3.7.6 bash-4.4$ rpm -qa | grep logrotate bash-4.4$ ls -lah /var/log/nginx total 8.0K drwxrwxrwx 2 nginx root 4.0K Aug 30 10:42 . drwxr-xr-x 4 root root 4.0K Aug 30 10:42 .. lrwxrwxrwx 1 root root 11 Aug 10 16:04 access.log -> /dev/stdout lrwxrwxrwx 1 root root 11 Aug 10 16:04 error.log -> /dev/stdout
Product(s)
Components
Category
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.