By default the Rancher v2.x server log level is set to
info; however, when investigating an issue it may be helpful to increase the log verbosity to
debug. This article details how to control the log verbosity on Rancher v2.x containers.
- A running instance of Rancher server v2.x, either a single node instance or High Availability (HA) cluster.
The log verbosity is set within a running Rancher server container by use of the
loglevel --set <verbosity>
kubectl with your cluster's context, you can update the log level of all your Rancher server containers by running the following:
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
where verbosity is one of
Instructions on how to run this command in either a single node or High Availability installation of Rancher can be found within the Rancher documentation under the "Logging" troubleshooting guide.
If the log level is increased to
debug for troubleshooting purposes, you should be sure to reduce to
info after the necessary logs have been captured, in order to reduce disk usage and minimise noise when reading the logs.