You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: Configuration for setting structured logging options for vCluster.
6
6
---
7
7
8
-
## vCluster logging
9
-
10
-
By default, vCluster prints out structured logs to the console. There are two logging options provided: `console` and `json`.
8
+
vCluster prints out structured logs to the console, by default. There are two log-encoding options provided: `console` and `json`.
11
9
12
10
The default logging option is set to `console`.
13
11
12
+
## Configure logging
13
+
14
+
To choose the logging encoding for vCluster logs, you can set the `logging.encoding` field in the `vcluster.yaml` to
15
+
one of the following values: `json` or `console`. For example:
16
+
```yaml
17
+
logging:
18
+
encoding: json
19
+
```
20
+
21
+
:::note
22
+
Setting `logging.encoding` value in vCluster.yaml only applies to the logs generated by vCluster and has no control over
23
+
platform generated logs. So, make sure that you have set the appropriate logging format in platform as well that suits
24
+
your requirements. Refer [platform logging](https://www.vcluster.com/docs/platform/administer/monitoring/metrics#configure-logging)
25
+
for configuring logging in platform.
26
+
:::
27
+
28
+
### Console logging
29
+
14
30
The logs in this format include constant log messages, a human-readable timestamp, log levels, the file and line numberof the source caller, and with variables in the body:
15
31
16
32
```text
@@ -21,6 +37,8 @@ The logs in this format include constant log messages, a human-readable timestam
21
37
22
38
```
23
39
40
+
### JSON logging
41
+
24
42
In addition to `console` logging, vCluster also supports printing logs encoded in JSON format.
25
43
26
44
This output format is helpful for structured logging, which allows you to search and filter logs easily.
@@ -39,24 +57,3 @@ The JSON encoded logs contain at least the following fields:
39
57
- `caller`: The file and line number of the message
40
58
- `msg`: The message itself
41
59
- `component`: The vCluster component that emitted the message
42
-
43
-
## Configure logging
44
-
45
-
To choose the logging field, you can set the `logging.encoding` field in the vcluster.yaml to the desired value. For example:
46
-
```yaml
47
-
logging:
48
-
encoding: console
49
-
```
50
-
51
-
To modify the log output by setting the Helm value `logging.encoding` to one of the following values: `json` or `console` ,
52
-
and upgrading your vCluster release. For example, you can change the logging encoding to `json` format with the following command:
0 commit comments