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
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
- A running instance of Rancher server v2.x, either a single node instance or High Availability (HA) cluster.
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.
- Document ID:000020239
- Creation Date: 06-May-2021
- Modified Date:27-Mar-2024
-
- SUSE Rancher
For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com