Skip to content

Commit f477695

Browse files
committed
docs: add per-target log levels and slow statement config to reference
Document CS_LOG__{TARGET}_LEVEL pattern with full target table, slow statement env vars, and their defaults in the Proxy config options section.
1 parent 178521a commit f477695

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

docs/reference/index.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ This page contains reference documentation for configuring CipherStash Proxy and
66

77
- [Proxy config options](#proxy-config-options)
88
- [Recommended settings for development](#recommended-settings-for-development)
9+
- [Per-target log levels](#per-target-log-levels)
910
- [Docker-specific configuration](#docker-specific-configuration)
1011
- [Prometheus metrics](#prometheus-metrics)
1112
- [Available metrics](#available-metrics)
@@ -208,6 +209,27 @@ output = "stdout"
208209
# Env: CS_LOG__ANSI_ENABLED
209210
ansi_enabled = "true"
210211

212+
# Enable slow statement logging
213+
# When enabled, logs detailed timing breakdowns for queries exceeding the threshold
214+
# Optional
215+
# Default: `false`
216+
# Env: CS_LOG__SLOW_STATEMENTS
217+
slow_statements = "false"
218+
219+
# Minimum duration in milliseconds for a statement to be considered slow
220+
# Statements exceeding this threshold are logged with phase-by-phase timing
221+
# Optional
222+
# Default: `2000`
223+
# Env: CS_LOG__SLOW_STATEMENT_MIN_DURATION_MS
224+
slow_statement_min_duration_ms = "2000"
225+
226+
# Minimum duration in milliseconds for a database response to be considered slow
227+
# Tracks per-message read latency from the PostgreSQL server connection
228+
# Optional
229+
# Default: `100`
230+
# Env: CS_LOG__SLOW_DB_RESPONSE_MIN_DURATION_MS
231+
slow_db_response_min_duration_ms = "100"
232+
211233

212234
[prometheus]
213235
# Enable prometheus stats
@@ -242,6 +264,36 @@ CS_DATABASE__CONFIG_RELOAD_INTERVAL="10"
242264
CS_DATABASE__SCHEMA_RELOAD_INTERVAL="10"
243265
```
244266

267+
### Per-target log levels
268+
269+
Proxy supports per-target log level overrides using the pattern `CS_LOG__{TARGET}_LEVEL`. Each target corresponds to an internal component, and can be set independently of the global `CS_LOG__LEVEL`.
270+
271+
Valid values: `error`, `warn`, `info`, `debug`, `trace`. Default for all targets: `info`.
272+
273+
| Environment variable | Target | Description |
274+
|---|---|---|
275+
| `CS_LOG__DEVELOPMENT_LEVEL` | `DEVELOPMENT` | General development logging |
276+
| `CS_LOG__AUTHENTICATION_LEVEL` | `AUTHENTICATION` | Client authentication and SASL |
277+
| `CS_LOG__CONFIG_LEVEL` | `CONFIG` | Configuration loading |
278+
| `CS_LOG__CONTEXT_LEVEL` | `CONTEXT` | Connection context |
279+
| `CS_LOG__ENCODING_LEVEL` | `ENCODING` | Data encoding and decoding |
280+
| `CS_LOG__ENCRYPT_LEVEL` | `ENCRYPT` | Encryption and decryption operations |
281+
| `CS_LOG__DECRYPT_LEVEL` | `DECRYPT` | Decryption operations |
282+
| `CS_LOG__ENCRYPT_CONFIG_LEVEL` | `ENCRYPT_CONFIG` | Encryption configuration loading |
283+
| `CS_LOG__ZEROKMS_LEVEL` | `ZEROKMS` | ZeroKMS cipher init, cache, and connectivity |
284+
| `CS_LOG__MIGRATE_LEVEL` | `MIGRATE` | Schema migration |
285+
| `CS_LOG__PROTOCOL_LEVEL` | `PROTOCOL` | PostgreSQL wire protocol |
286+
| `CS_LOG__MAPPER_LEVEL` | `MAPPER` | SQL statement mapping and transformation |
287+
| `CS_LOG__SCHEMA_LEVEL` | `SCHEMA` | Database schema analysis |
288+
| `CS_LOG__SLOW_STATEMENTS_LEVEL` | `SLOW_STATEMENTS` | Slow statement detection |
289+
290+
Example — enable debug logging for encryption and ZeroKMS:
291+
292+
```bash
293+
CS_LOG__ENCRYPT_LEVEL="debug"
294+
CS_LOG__ZEROKMS_LEVEL="debug"
295+
```
296+
245297
### Docker-specific configuration
246298

247299
As a convenience for local development, if you use [Proxy's Docker container](../proxy.Dockerfile) with its default entrypoint and the below environment variables set, the EQL SQL will be applied to the database, and an example schema (for example, with the `users` table, from the [README Getting Started example](../README.md#getting-started)) will be loaded. These are turned on by default in the [development `docker-compose.yml`](../docker-compose.yml):

0 commit comments

Comments
 (0)