How and when do you sample logs?
IntermediateProductionLog Pipelines
Answer
Never sample errors, warnings, audit or security logs. Sample high-volume, low-value lines (successful health checks, 200 OK access logs) at 1–10%, and record the sample rate as a field so counts can be scaled back:
[transforms.sample_access]
type = "sample"
inputs = ["access_logs"]
rate = 10 # keep 1 in 10
exclude = '.status >= 400'
Better still, turn those access logs into metrics (rate, latency) and stop shipping most of them.
More on Log Pipelines
What does a production log pipeline look like end to end?BeginnerWhy structured (JSON) logging, and what fields should every log line have?BeginnerFluent Bit, Vector, Grafana Alloy or the OpenTelemetry Collector: how do you choose a log agent?IntermediateWhy add an aggregation tier instead of sending directly from agents to the backend?IntermediateHow do you design log retention tiers?IntermediateHow do you scrub PII from logs in the pipeline?Intermediate