How to change the log level for Rancher v2.x

Follow
Table of Contents

Task

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.

Pre-requisites

Resolution

The log verbosity is set within a running Rancher server container by use of the loglevel command:

loglevel --set <verbosity>

Using 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 error, info or debug.

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.

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.