mirror of
https://github.com/rancher/rancher-docs.git
synced 2026-09-26 13:08:11 +00:00
Merge pull request #2413 from superseb/loglevel
Describe Rancher log levels
This commit is contained in:
@@ -56,55 +56,7 @@ New password for default admin user (user-xxxxx):
|
|||||||
|
|
||||||
### How can I enable debug logging?
|
### How can I enable debug logging?
|
||||||
|
|
||||||
* Docker Install
|
See [Troubleshooting: Logging]({{<baseurl>}}/rancher/v2.x/en/troubleshooting/logging/)
|
||||||
* Enable
|
|
||||||
```
|
|
||||||
$ docker exec -ti <container_id> loglevel --set debug
|
|
||||||
OK
|
|
||||||
$ docker logs -f <container_id>
|
|
||||||
```
|
|
||||||
|
|
||||||
* Disable
|
|
||||||
```
|
|
||||||
$ docker exec -ti <container_id> loglevel --set info
|
|
||||||
OK
|
|
||||||
```
|
|
||||||
|
|
||||||
* Kubernetes install (Helm)
|
|
||||||
* Enable
|
|
||||||
```
|
|
||||||
$ KUBECONFIG=./kube_config_rancher-cluster.yml
|
|
||||||
$ kubectl --kubeconfig $KUBECONFIG -n cattle-system get pods -l app=rancher | grep '1/1' | awk '{ print $1 }' | xargs -I{} kubectl --kubeconfig $KUBECONFIG -n cattle-system exec {} -- loglevel --set debug
|
|
||||||
OK
|
|
||||||
OK
|
|
||||||
OK
|
|
||||||
$ kubectl --kubeconfig $KUBECONFIG -n cattle-system logs -l app=rancher
|
|
||||||
```
|
|
||||||
|
|
||||||
* Disable
|
|
||||||
```
|
|
||||||
$ KUBECONFIG=./kube_config_rancher-cluster.yml
|
|
||||||
$ kubectl --kubeconfig $KUBECONFIG -n cattle-system get pods -l app=rancher | grep '1/1' | awk '{ print $1 }' | xargs -I{} kubectl --kubeconfig $KUBECONFIG -n cattle-system exec {} -- loglevel --set info
|
|
||||||
OK
|
|
||||||
OK
|
|
||||||
OK
|
|
||||||
```
|
|
||||||
|
|
||||||
* Kubernetes install (RKE add-on)
|
|
||||||
* Enable
|
|
||||||
```
|
|
||||||
$ KUBECONFIG=./kube_config_rancher-cluster.yml
|
|
||||||
$ kubectl --kubeconfig $KUBECONFIG exec -n cattle-system $(kubectl --kubeconfig $KUBECONFIG get pods -n cattle-system -o json | jq -r '.items[] | select(.spec.containers[].name=="cattle-server") | .metadata.name') -- loglevel --set debug
|
|
||||||
OK
|
|
||||||
$ kubectl --kubeconfig $KUBECONFIG logs -n cattle-system -f $(kubectl --kubeconfig $KUBECONFIG get pods -n cattle-system -o json | jq -r '.items[] | select(.spec.containers[].name="cattle-server") | .metadata.name')
|
|
||||||
```
|
|
||||||
|
|
||||||
* Disable
|
|
||||||
```
|
|
||||||
$ KUBECONFIG=./kube_config_rancher-cluster.yml
|
|
||||||
$ kubectl --kubeconfig $KUBECONFIG exec -n cattle-system $(kubectl --kubeconfig $KUBECONFIG get pods -n cattle-system -o json | jq -r '.items[] | select(.spec.containers[].name=="cattle-server") | .metadata.name') -- loglevel --set info
|
|
||||||
OK
|
|
||||||
```
|
|
||||||
|
|
||||||
### My ClusterIP does not respond to ping
|
### My ClusterIP does not respond to ping
|
||||||
|
|
||||||
|
|||||||
@@ -35,3 +35,8 @@ This section contains information to help you troubleshoot issues when using Ran
|
|||||||
- [Imported clusters]({{<baseurl>}}/rancher/v2.x/en/troubleshooting/imported-clusters/)
|
- [Imported clusters]({{<baseurl>}}/rancher/v2.x/en/troubleshooting/imported-clusters/)
|
||||||
|
|
||||||
If you experience issues when [Importing Kubernetes Clusters]({{<baseurl>}}/rancher/v2.x/en/cluster-provisioning/imported-clusters/)
|
If you experience issues when [Importing Kubernetes Clusters]({{<baseurl>}}/rancher/v2.x/en/cluster-provisioning/imported-clusters/)
|
||||||
|
|
||||||
|
- [Logging]({{<baseurl>}}/rancher/v2.x/en/troubleshooting/logging/)
|
||||||
|
|
||||||
|
Read more about what log levels can be configured and how to configure a log level.
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
---
|
||||||
|
title: Logging
|
||||||
|
weight: 110
|
||||||
|
---
|
||||||
|
|
||||||
|
The following log levels are used in Rancher:
|
||||||
|
|
||||||
|
| Name | Description |
|
||||||
|
|---------|-------------|
|
||||||
|
| `info` | Logs informational messages. This is the default log level. |
|
||||||
|
| `debug` | Logs more detailed messages that can be used to debug. |
|
||||||
|
| `trace` | Logs 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
|
||||||
|
```
|
||||||
|
$ KUBECONFIG=./kube_config_rancher-cluster.yml
|
||||||
|
$ kubectl --kubeconfig $KUBECONFIG -n cattle-system get pods -l app=rancher | grep '1/1' | awk '{ print $1 }' | while read rancherpod; do kubectl --kubeconfig $KUBECONFIG -n cattle-system exec $rancherpod -- loglevel --set debug; done
|
||||||
|
OK
|
||||||
|
OK
|
||||||
|
OK
|
||||||
|
$ kubectl --kubeconfig $KUBECONFIG -n cattle-system logs -l app=rancher
|
||||||
|
```
|
||||||
|
|
||||||
|
* Configure info log level
|
||||||
|
```
|
||||||
|
$ KUBECONFIG=./kube_config_rancher-cluster.yml
|
||||||
|
$ kubectl --kubeconfig $KUBECONFIG -n cattle-system get pods -l app=rancher | grep '1/1' | awk '{ print $1 }' | while read rancherpod; do kubectl --kubeconfig $KUBECONFIG -n cattle-system exec $rancherpod -- loglevel --set info; done
|
||||||
|
OK
|
||||||
|
OK
|
||||||
|
OK
|
||||||
|
```
|
||||||
|
|
||||||
|
* Docker Install
|
||||||
|
* Configure debug log level
|
||||||
|
```
|
||||||
|
$ docker exec -ti <container_id> loglevel --set debug
|
||||||
|
OK
|
||||||
|
$ docker logs -f <container_id>
|
||||||
|
```
|
||||||
|
|
||||||
|
* Configure info log level
|
||||||
|
```
|
||||||
|
$ docker exec -ti <container_id> loglevel --set info
|
||||||
|
OK
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user