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
Copy file name to clipboardExpand all lines: CHANGELOG.md
+18Lines changed: 18 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,24 @@ All notable changes to CipherStash Proxy will be documented in this file.
4
4
5
5
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
6
6
7
+
## [Unreleased]
8
+
9
+
### Changed
10
+
11
+
-**Log target renamed**: `KEYSET` log target renamed to `ZEROKMS`. The environment variable `CS_LOG__KEYSET_LEVEL` is now `CS_LOG__ZEROKMS_LEVEL`.
12
+
13
+
### Removed
14
+
15
+
-**Log target removed**: `PROXY` log target and `CS_LOG__PROXY_LEVEL` environment variable have been removed.
16
+
17
+
### Added
18
+
19
+
-**Cipher cache miss metric**: New Prometheus counter `cipherstash_proxy_keyset_cipher_cache_miss_total` tracks cache misses requiring cipher initialization. This complements the `cipherstash_proxy_keyset_cipher_cache_hit_total` metric, and can be used to calculate cache hit/miss ratio.
20
+
-**Cipher init duration metric**: New Prometheus histogram `cipherstash_proxy_keyset_cipher_init_duration_seconds` tracks cipher initialization time including ZeroKMS network calls.
21
+
-**Encrypt/decrypt timing**: Debug logs for `encrypt_eql` and `decrypt_eql` now include `duration_ms`.
22
+
-**Cache eviction logging**: ScopedCipher cache eviction events are now logged under the `ZEROKMS` target.
23
+
-**Slow cipher init warning**: Cipher initialization taking longer than 1 second triggers a warning log.
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 |
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
+
244
297
### Docker-specific configuration
245
298
246
299
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):
@@ -478,7 +531,9 @@ If the proxy is running on a host other than localhost, access on that host.
|`cipherstash_proxy_keyset_cipher_cache_hits_total`| Counter | Number of times a keyset-scoped cipher was found in the cache |
534
+
|`cipherstash_proxy_keyset_cipher_cache_miss_total`| Counter | Number of cipher cache misses requiring initialization |
481
535
|`cipherstash_proxy_keyset_cipher_init_total`| Counter | Number of times a new keyset-scoped cipher has been initialized |
536
+
|`cipherstash_proxy_keyset_cipher_init_duration_seconds`| Histogram | Duration of cipher initialization including ZeroKMS network call |
482
537
|`cipherstash_proxy_clients_active_connections`| Gauge | Current number of connections to CipherStash Proxy from clients |
483
538
|`cipherstash_proxy_clients_bytes_received_total`| Counter | Number of bytes received by CipherStash Proxy from clients |
484
539
|`cipherstash_proxy_clients_bytes_sent_total`| Counter | Number of bytes sent from CipherStash Proxy to clients |
@@ -510,6 +565,68 @@ If the proxy is running on a host other than localhost, access on that host.
510
565
|`cipherstash_proxy_statements_total`| Counter | Total number of SQL statements processed by CipherStash Proxy |
511
566
|`cipherstash_proxy_statements_unmappable_total`| Counter | Total number of unmappable SQL statements processed by CipherStash Proxy |
512
567
568
+
## Troubleshooting ZeroKMS connections
569
+
570
+
### Recommended log settings
571
+
572
+
For a quick check on ZeroKMS latency and connection issues:
573
+
574
+
```bash
575
+
CS_LOG__ZEROKMS_LEVEL=debug
576
+
CS_LOG__ENCRYPT_LEVEL=debug
577
+
```
578
+
579
+
For a deeper investigation, also enable slow statement detection:
580
+
581
+
```bash
582
+
CS_LOG__ZEROKMS_LEVEL=trace
583
+
CS_LOG__SLOW_STATEMENTS=true
584
+
CS_LOG__SLOW_STATEMENT_MIN_DURATION_MS=500
585
+
CS_LOG__SLOW_DB_RESPONSE_MIN_DURATION_MS=50
586
+
```
587
+
588
+
### What to look for in logs
589
+
590
+
| Signal | Meaning |
591
+
|--------|---------|
592
+
|`Initializing ZeroKMS ScopedCipher (cache miss)`| Network call to ZeroKMS is about to happen. Frequent occurrences indicate cache churn. |
593
+
|`Connected to ZeroKMS` with high `init_duration_ms`| Slow cipher init. Healthy values are <200ms; >1s triggers a warning. |
594
+
|`Use cached ScopedCipher`| Cache hit (fast path, no network call). |
595
+
|`ScopedCipher evicted from cache` with `cause: Size`| Cache too small for workload. Increase `cipher_cache_size`. |
596
+
|`Error initializing ZeroKMS` with high `init_duration_ms`| Network timeout to ZeroKMS. |
597
+
|`Error initializing ZeroKMS` with low `init_duration_ms`| Credential or configuration error. |
598
+
599
+
### Key metrics
600
+
601
+
Enable Prometheus (`CS_PROMETHEUS__ENABLED=true`) and watch these metrics:
602
+
603
+
| Metric | Why |
604
+
|--------|-----|
605
+
|`cipherstash_proxy_keyset_cipher_init_duration_seconds`| Distribution of ZeroKMS init times including network latency. |
606
+
|`cipherstash_proxy_keyset_cipher_cache_hits_total` / `cache_miss_total`| Cache hit ratio — should be >95% in steady state. |
607
+
|`cipherstash_proxy_statements_session_duration_seconds` minus `execution_duration_seconds`| Encryption overhead per statement (large gap = encryption, not database). |
0 commit comments