Skip to content

Commit 428bf53

Browse files
committed
formatted the logging docs
1 parent 265e1d2 commit 428bf53

File tree

1 file changed

+22
-25
lines changed

1 file changed

+22
-25
lines changed
Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,32 @@
11
---
22
title: Logging
33
sidebar_label: logging
4-
sidebar_position: 9
4+
sidebar_position: 13
55
description: Configuration for setting structured logging options for vCluster.
66
---
77

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`.
119

1210
The default logging option is set to `console`.
1311

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+
1430
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:
1531

1632
```text
@@ -21,6 +37,8 @@ The logs in this format include constant log messages, a human-readable timestam
2137
2238
```
2339

40+
### JSON logging
41+
2442
In addition to `console` logging, vCluster also supports printing logs encoded in JSON format.
2543

2644
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:
3957
- `caller`: The file and line number of the message
4058
- `msg`: The message itself
4159
- `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:
53-
54-
```bash
55-
helm upgrade <release-name> vcluster --repo https://charts.loft.sh/ \
56-
--namespace <vcluster-namespace> \
57-
--reuse-values \
58-
--set logging.encoding=json
59-
```
60-
61-
62-

0 commit comments

Comments
 (0)