Skip to content

Commit 35f1f19

Browse files
Update logging.mdx
1 parent d15fef5 commit 35f1f19

File tree

1 file changed

+20
-33
lines changed

1 file changed

+20
-33
lines changed

vcluster/configure/vcluster-yaml/logging.mdx

Lines changed: 20 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -8,34 +8,25 @@ description: Configuration for setting structured logging options for vCluster.
88
import InterpolatedCodeBlock from '@site/src/components/InterpolatedCodeBlock'
99
import Logging from '../../_partials/config/logging.mdx'
1010

11-
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+
By default, vCluster creates logs in the control plane pod in console format, which is easy to read and preferred for manual log review. However, you can configure the logging in the control plane pod to JSON format. By enabling the JSON format, logs can be sent to external tools to aggregate logs across multiple virtual clusters to help monitor and troubleshoot these virtual clusters.
1212

13-
## Configure log encoding
14-
15-
You can set the log encoding format in your `vcluster.yaml` configuration:
13+
## Log encoding formats
1614

17-
<InterpolatedCodeBlock
18-
code={`logging:
19-
encoding: [[VAR:ENCODING:json]]`}
20-
language="yaml"
21-
/>
15+
vCluster supports two log encoding formats for the vCluster control plane pod.
2216

23-
Select either `json` or `console` for the `encoding` value.
17+
- console (_Default_): Human-readable format. Ideal for development and manual log review.
18+
- JSON: Structured format for log aggregation. Ideal for external monitoring and analysis tools.
2419

2520
:::note Platform logging
26-
The `logging.encoding` setting only affects vCluster component logs. Platform-generated logs use a separate configuration.
21+
The `logging.encoding` setting only affects vCluster control plane pod logs. Platform logs generated from a virtual cluster connected to the platform uses a separate configuration and will not be affected by these formats.
2722
:::
2823

29-
## Log encoding formats
30-
31-
vCluster supports two log encoding formats:
32-
33-
- [console](#console-format) (_Default_): Human-readable format ideal for development and manual log review.
34-
- [JSON](#json-format): Structured format for log aggregation and automated analysis.
35-
3624
### Console format
3725

38-
The console format provides human-readable logs with timestamps, log levels, source locations, and contextual information:
26+
The console format provides human-readable logs with timestamps, log levels, source locations, and contextual information. The console format is best suited for use cases where users will be troubleshooting a single virtual cluster. Choose this format in environments where human readability is more important than structured log parsing. Example use cases include:
27+
28+
* Local development and testing, where developers benefit from quick, readable output
29+
* Single virtual cluster analysis, where users will manually review logs and debug in a terminal
3930

4031
```text
4132
2025-06-16 04:43:25 INFO license loader/inject.go:52 initializing license... {"component": "vcluster"}
@@ -44,11 +35,11 @@ The console format provides human-readable logs with timestamps, log levels, sou
4435
2025-06-16 04:43:29 INFO online/license.go:146 rancher-integration {"component": "vcluster"}
4536
```
4637

47-
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.
48-
4938
### JSON format
5039

51-
The JSON format structures log data for programmatic processing and integration with log management systems:
40+
The JSON format structures log data for programmatic processing and integration with log management systems. The JSON format is best suited for use cases where external tools are used to monitor and analyze logs for multiple virtual clusters. Log aggregation tools (e.g. Elasticsearch or Splunk) can ingest these logs to support automated analysis, alerting, and integration with monitoring platforms (e.g. Prometheus and Grafana). Examples use cases include:
41+
42+
* Product environments where multiple virtual clusters are being monitored and logs from all of them need need to be parsed and processed automatically.
5243

5344
```json
5445
{"level":"info","ts":1750160027.442782,"logger":"license","caller":"loader/inject.go:52","msg":"initializing license...","component":"vcluster"}
@@ -71,26 +62,22 @@ Each JSON log entry contains the following standard fields:
7162

7263
Additional fields might be displayed based on context and log content.
7364

74-
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.
75-
76-
## Examples
65+
## Enable log encoding
7766

78-
### Development environment
67+
Logging is enabled in your `vcluster.yaml` configuration file.
7968

80-
For local development with human-readable logs:
69+
You can enable the JSON format of log encoding.
8170

82-
```yaml
71+
```yaml
8372
logging:
84-
encoding: console
73+
encoding: json
8574
```
8675
87-
### Production environment
88-
89-
For production with structured logging and monitoring:
76+
If you want to disable the JSON format, you can either remove the `logging` field or explicitly set the console format.
9077

9178
```yaml
9279
logging:
93-
encoding: json
80+
encoding: console
9481
```
9582

9683
## Config reference

0 commit comments

Comments
 (0)