Skip to content

How to change the log level for Rancher v2.x

This document (000020239) is provided subject to the disclaimer at the end of this document.

Environment

SUSE Rancher v2.x

Situation

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.

Disclaimer

This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.