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
vCluster outputs structured logs that help you monitor and troubleshoot your virtual clusters. You can configure the log format to suit your monitoring and analysis tools and workflows.
11
11
12
-
## Configure logging
12
+
## Configure log encoding
13
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
-
```
14
+
You can set the log encoding format in your `vcluster.yaml` configuration:
20
15
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.
16
+
<InterpolatedCodeBlock
17
+
code={`logging:
18
+
encoding: [[VAR:ENCODING:json]]`}
19
+
language="yaml"
20
+
/>
21
+
22
+
Select either `json` or `console` for the `encoding` value.
23
+
24
+
:::note Platform logging
25
+
The `logging.encoding` setting only affects vCluster component logs. Platform-generated logs use a separate configuration.
26
26
:::
27
27
28
-
### Console logging
28
+
## Log encoding formats
29
+
30
+
vCluster supports two log encoding formats:
31
+
32
+
-[console](#console-format) (_Default_): Human-readable format ideal for development and manual log review.
33
+
-[JSON](#json-format): Structured format for log aggregation and automated analysis.
29
34
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:
35
+
### Console format
36
+
37
+
The console format provides human-readable logs with timestamps, log levels, source locations, and contextual information:
31
38
32
39
```text
33
40
2025-06-16 04:43:25 INFO license loader/inject.go:52 initializing license... {"component": "vcluster"}
34
41
2025-06-16 04:43:25 INFO license loader/inject.go:59 detected license type {"component": "vcluster", "licenseType": "Online"}
35
42
2025-06-16 04:43:29 INFO online/license.go:141 Enabled features: {"component": "vcluster"}
36
43
2025-06-16 04:43:29 INFO online/license.go:146 rancher-integration {"component": "vcluster"}
37
-
38
44
```
39
45
40
-
### JSON logging
46
+
The console format is best suited for local development and testing, where developers benefit from quick, readable output. It also works well for manual log review and debugging, especially when troubleshooting issues directly in the terminal. Choose this format in environments where human readability is more important than structured log parsing.
41
47
42
-
In addition to `console` logging, vCluster also supports printing logs encoded in JSON format.
48
+
### JSON format
43
49
44
-
This output format is helpful for structured logging, which allows you to search and filter logs easily.
50
+
The JSON format structures log data for programmatic processing and integration with log management systems:
|`ts`| number | Unix timestamp (seconds since epoch) |
67
+
|`caller`| string | Source file and line number |
68
+
|`msg`| string | Log message content |
69
+
|`component`| string | vCluster component that generated the log |
70
+
71
+
Additional fields might be displayed based on context and log content.
72
+
73
+
The JSON format is ideal for production environments where logs need to be parsed and processed automatically. It works well with log aggregation tools like Elasticsearch or Splunk and supports automated analysis, alerting, and integration with monitoring platforms such as Prometheus and Grafana.
74
+
75
+
## Examples
76
+
77
+
### Development environment
78
+
79
+
For local development with human-readable logs:
80
+
81
+
```yaml
82
+
logging:
83
+
encoding: console
84
+
```
85
+
86
+
### Production environment
87
+
88
+
For production with structured logging and monitoring:
89
+
90
+
```yaml
91
+
logging:
92
+
encoding: json
93
+
```
94
+
95
+
## Config reference
96
+
97
+
<Logging />
54
98
55
-
- `level`: The log level of the message
56
-
- `ts`: The timestamp of the message (floating-point number of seconds since the Unix epoch)
57
-
- `caller`: The file and line number of the message
58
-
- `msg`: The message itself
59
-
- `component`: The vCluster component that emitted the message
0 commit comments