Logging


The following log levels are used in Rancher:

NameDescription
infoLogs informational messages. This is the default log level.
debugLogs more detailed messages that can be used to debug.
traceLogs very detailed messages on internal functions. This is very verbose and can contain sensitive information.

How to configure a log level

  • Kubernetes install

    • Configure debug log level

      1. $ KUBECONFIG=./kube_config_rancher-cluster.yml
      2. $ kubectl -n cattle-system get pods -l app=rancher --no-headers -o custom-columns=name:.metadata.name | while read rancherpod; do kubectl -n cattle-system exec $rancherpod -c rancher -- loglevel --set debug; done
      3. OK
      4. OK
      5. OK
      6. $ kubectl -n cattle-system logs -l app=rancher -c rancher
    • Configure info log level

      1. $ KUBECONFIG=./kube_config_rancher-cluster.yml
      2. $ kubectl -n cattle-system get pods -l app=rancher --no-headers -o custom-columns=name:.metadata.name | while read rancherpod; do kubectl -n cattle-system exec $rancherpod -c rancher -- loglevel --set info; done
      3. OK
      4. OK
      5. OK
  • Docker Install

    • Configure debug log level

      1. $ docker exec -ti <container_id> loglevel --set debug
      2. OK
      3. $ docker logs -f <container_id>
    • Configure info log level

      1. $ docker exec -ti <container_id> loglevel --set info
      2. OK