Retention

7 Tools for Sampling Logs to Cut Costs

Apply log sampling with seven tools that keep a useful fraction of log volume instead of storing everything, without losing the signal.

On this page
  1. Key takeaways
  2. Why sampling tames log volume
  3. Quick comparison
  4. The best tools for sampling logs to cut costs
  5. How we chose
  6. FAQ
  7. Sources

Key takeaways

  • Repeated routine lines dominate log volume.
  • Sampling keeps a useful fraction and drops the rest.
  • Keeping errors while sampling normal traffic preserves signal.
  • Less volume means lower storage and service cost.

Why sampling tames log volume

Most log lines are repeats of the same few messages, and storing every one is a cost that buys little. Sampling keeps a fraction of the volume, chosen so the interesting events survive while the noise is dropped.

The tools below each reduce log volume before or during storage. Some apply fixed rates, others keep errors and drop routine lines, and a few do both.

Quick comparison

ToolBest forStarting priceFree plan
Fluent Bitedge log samplingNot includedNot included
Vectorsampling in a pipelineNot includedNot included
Logstashcentralized sampling filtersNot includedNot included
Filebeatprocessors to reduce volumeNot includedNot included
OpenTelemetrycollector based samplingNot includedNot included
Datadogmanaged sampling controlsNot includedNot included
Grafana Lokicheap storage as an alternativeNot includedNot included

The best tools for sampling logs to cut costs

1. Fluent Bit

  • Official site: https://fluentbit.io/
  • Best for: edge log sampling
  • Starting price: Not included
  • Free plan: Not included
  • Pros: lightweight; filters built in
  • Cons: config is specific; fewer transforms

Fluent Bit can filter and drop log lines at the source, so only a chosen fraction is ever forwarded. Its filters match lines and decide which survive based on fields or rates. Fluent Bit drops lines before they leave the host, which saves on network and storage at the same time.

Teams use Fluent Bit to cut volume before it leaves the host, which saves both network and storage. Rules can keep errors and sample normal traffic. It is the cheapest place to sample. Because the drop happens at the source, the saved volume is never shipped or stored, which saves on every later cost.

2. Vector

  • Official site: https://vector.dev/
  • Best for: sampling in a pipeline
  • Starting price: Not included
  • Free plan: Not included
  • Pros: rich transforms; single binary
  • Cons: newer; config to learn

Vector can sample logs with its transforms, dropping lines by rate or condition as they flow through the pipeline. It is flexible about what is kept and what is cut. Vector applies the sampling rules in a readable config, so the team can review what is kept and what is cut.

Teams use Vector when sampling is one part of a larger pipeline. Its declarative config makes the sampling rules readable. It can sample at the edge or centrally. Its declarative rules make the sampling policy readable, so the team can see at a glance what is kept and what is cut.

3. Logstash

  • Official site: https://www.elastic.co/logstash
  • Best for: centralized sampling filters
  • Starting price: Not included
  • Free plan: Not included
  • Pros: deep filters; many outputs
  • Cons: heavy; JVM resource use

Logstash can sample logs with its filters, dropping lines by percentage or condition before they reach storage. It runs centrally, so sampling happens after collection. Logstash can keep errors and sample the rest, which preserves the debugging value while cutting the volume.

Teams use Logstash when they want sampling applied in a central pipeline with rich conditions. It can keep errors and sample the rest. The cost is a heavier central component. Its filters can keep errors and sample the rest, which preserves the debugging value while cutting the volume.

4. Filebeat

  • Official site: https://www.elastic.co/beats/filebeat
  • Best for: processors to reduce volume
  • Starting price: Not included
  • Free plan: Not included
  • Pros: lightweight; processors built in
  • Cons: fewer transforms; Elastic focused

Filebeat can drop or limit log lines with its processors, reducing what is shipped. It is a light way to cut volume at the source before anything is stored. Filebeat's processors cover basic dropping at the source, which is often enough for a small fleet.

Teams use Filebeat when they already ship with it and want a simple reduction. Its processors cover basic dropping and rate limiting. For complex sampling, Logstash downstream adds more control. Processors at the source cover the basic case of dropping and rate limiting without a heavier pipeline.

5. OpenTelemetry

  • Official site: https://opentelemetry.io/
  • Best for: collector based sampling
  • Starting price: Not included
  • Free plan: Not included
  • Pros: standard; flexible processor
  • Cons: configuration work; many options

The OpenTelemetry collector can sample logs with its processors, applying rate and probabilistic rules before exporting them. It is the standard plumbing when a team wants vendor neutral sampling. OpenTelemetry applies the same sampling no matter which vendor the logs are exported to, keeping the rules portable.

Teams use the OpenTelemetry collector when they want sampling independent of any one vendor. Its processors handle both fixed rates and condition based dropping. The setup takes some configuration. The collector applies the same sampling rules no matter which vendor the logs are exported to.

6. Datadog

  • Official site: https://www.datadoghq.com/
  • Best for: managed sampling controls
  • Starting price: Not included
  • Free plan: Not included
  • Pros: managed; ingestion filters
  • Cons: paid; less direct control

Datadog applies sampling and ingestion filters to logs before they are indexed, so teams pay for less stored data. Rules can keep certain sources and sample the rest. Datadog's ingestion filters tie sampling directly to the bill, since less indexed volume means a lower cost.

Teams use Datadog's sampling when they want volume control handled by the platform. It directly reduces the bill, since pricing follows ingested and indexed volume. The control is less granular than a self built pipeline. Ingestion filters tie sampling directly to the bill, since less indexed volume means a lower cost.

7. Grafana Loki

  • Official site: https://grafana.com/oss/loki/
  • Best for: cheap storage as an alternative
  • Starting price: Not included
  • Free plan: Not included
  • Pros: low cost retention; S3 native
  • Cons: not sampling itself; Grafana needed

Loki does not sample logs, but it stores them so cheaply that teams often choose it instead of dropping data. Its object storage backend changes the math on whether sampling is even needed. Loki stores logs so cheaply that some teams skip sampling entirely and keep everything in object storage.

Teams use Loki when the goal of sampling is cost, because Loki's cheap storage may achieve it without losing any logs. Keeping everything in object storage is sometimes simpler than deciding what to drop. Cheap object storage changes the math, and sometimes keeping everything costs less than deciding what to drop.

How we chose

We looked for tools that reduce log volume without losing the lines that matter. Each tool must be able to drop routine lines while keeping errors and other high value events.

We favored tools that sample early, since cutting volume at the source saves every downstream cost. The list spans edge agents, central pipelines, managed platforms, and the cheap storage that sometimes makes sampling unnecessary.

FAQ

Why sample logs instead of keeping everything?

Because most volume is repeated routine lines, and storing them all is a cost that adds little value. Sampling keeps the useful fraction and drops the noise, cutting the bill.

How do I choose a sampling rate?

Start from how much you can afford to store and which lines matter. A common pattern is to keep all errors and sample normal traffic at a low rate, which preserves debugging value.

What should never be sampled away?

Errors, security events, and anything needed for compliance. The rules should protect those categories while sampling the routine traffic around them.

Does sampling hurt troubleshooting?

It can, if it drops the exact line you need. Keeping errors and rare events while sampling routine lines usually avoids that, so the interesting logs survive.

Is sampling always the best way to cut cost?

Not always. Cheaper storage such as Loki's object storage backend can make full retention affordable, which avoids the tradeoffs sampling introduces.

Sources