Increasing the Log Level on the OpenShift Router Pod

Solution Verified - Updated

Environment

  • Red Hat OpenShift Container Platform 3

Issue

  • How to increase log levels in the router deployment in OpenShift
  • View debug logs for router

Resolution

Add an argument section to the router deployment configuration

$ oc edit dc router
. . .
    spec:
      containers:
      - env:
        - name: DEFAULT_CERTIFICATE_DIR
          value: /etc/pki/tls/private
        - name: ROUTER_EXTERNAL_HOST_HOSTNAME
        - name: ROUTER_EXTERNAL_HOST_HTTPS_VSERVER
. . .
. . .
        - name: STATS_PORT
          value: "1936"
        - name: STATS_USERNAME
          value: admin
        image: openshift3/ose-haproxy-router:v3.11
        imagePullPolicy: IfNotPresent
        args:
          - '--loglevel=4'
. . .

For debugging purposes it may also be useful to modify the livenessProbe and readinessProbe with larger timeouts:

$ oc edit dc router
. . .
        livenessProbe:
          failureThreshold: 10
          httpGet:
            host: localhost
            path: /healthz
            port: 1936
            scheme: HTTP
          initialDelaySeconds: 10
          periodSeconds: 10
          successThreshold: 1
          timeoutSeconds: 30
. . .
        readinessProbe:
          failureThreshold: 10
          httpGet:
            host: localhost
            path: /healthz
            port: 1936
            scheme: HTTP
          initialDelaySeconds: 10
          periodSeconds: 10
          successThreshold: 1
          timeoutSeconds: 30

Diagnostic Steps

Be aware that increasing the loglevel can use significantly more disk space due to increased verbosity in the logs. This should generally be limited to debugging purposes only.

SBR
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.