This document explains how to control persistent query-log growth under high
traffic and how logging.query_log_sampling behaves.
- Full example:
example_configs/logging/query_log_hardening.yaml - Related README section:
README.md→ 2.5 Stats and query log.
Use logging.query_log_sampling to reduce persistent query-log volume before
rows are written to the configured stats backend.
logging:
query_log_sampling:
enabled: true
sample_rate: 0.25Fields:
enabled(bool, defaulttrue)- When
false, suppresses persistent query-log writes from the stats collector.
- When
sample_rate(number,0..1)1.0: write all rows.0.25: keep about 25% of rows.0.0: write none.
rate(number,0..1)- Compatibility alias for
sample_rate.
- Compatibility alias for
Legacy alias:
logging.query_log_sample_rateis supported as a compatibility alias.
- Sampling applies to persistent query-log rows. It does not disable the in-memory statistics counters used for runtime snapshots/log summaries.
- Sampling is evaluated before query-log dedupe.
- Dedupe can further reduce rows via
logging.query_log_dedupe. - For sampling to have persistent effect, you must have stats enabled and a
configured persistence backend selected by
stats.source_backend.
Sampling works best when combined with:
logging.query_log_retention:max_recordsdaysmax_bytesprune_interval_secondsprune_every_n_inserts
logging.max_logging_queueto bound async queue memory.logging.query_log_dedupe.window_secondsto suppress short-window repeats.