Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions products/kubernetes-operator/guides/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,47 @@ spec:

When enabled, the operator synchronizes Replicated and integration tables to new replicas.

### Server logging {#server-logging}

Configure the ClickHouse server log through `spec.settings.logger`. Every field is optional with a safe default, so a cluster you never touch already logs at `trace` to both the container console and a rotated file on disk.

```yaml
spec:
settings:
logger:
logToFile: true # Default: true. Set false to log only to the console
jsonLogs: false # Default: false. Set true for structured JSON log lines
level: trace # Default: trace
size: 1000M # Default: 1000M. Rotate a log file once it reaches this size
count: 50 # Default: 50. Number of rotated files to keep
```

| Field | Default | Description |
|---|---|---|
| `logToFile` | `true` | When `false`, the operator drops the file targets and the server logs only to the container console. |
| `jsonLogs` | `false` | When `true`, the operator adds `formatting.type: json` so each line is a JSON object. |
| `level` | `trace` | Log verbosity. One of `test`, `trace`, `debug`, `information`, `notice`, `warning`, `error`, `critical`, `fatal`. |
| `size` | `1000M` | Maximum size of a single log file before rotation. |
| `count` | `50` | Number of rotated log files the server retains. |

The operator always keeps console logging on so that `kubectl logs` works, and layers file logging on top when `logToFile` is `true`. A cluster with the defaults renders this `logger` block:

```yaml
logger:
console: true
level: trace
log: /var/log/clickhouse-server/clickhouse-server.log
errorlog: /var/log/clickhouse-server/clickhouse-server.err.log
size: 1000M
count: 50
```

The same `spec.settings.logger` block applies to a `KeeperCluster`; the operator writes its files under `/var/log/clickhouse-keeper/` instead.

<Note>
Console logging stays on regardless of `logToFile`, so `kubectl logs` keeps working even when you disable file logging. Set `jsonLogs: true` when you ship logs to a structured log store that parses JSON.
</Note>

## Custom configuration {#custom-configuration}

### Embedded extra configuration {#embedded-extra-configuration}
Expand Down