123DevOps··5 min read

Telemetry pipelines with OTel Collector, Vector, and Cribl: filtering data before you pay to store it

Filtering, sampling, masking, aggregating, and routing telemetry before ingestion: examples with the OpenTelemetry Collector and Vector, tail sampling, logs to metrics, and cheap storage with replay.

Observability

Telemetry volume tends to grow faster than the business. Every new service brings logs, metrics, and traces; every new replica multiplies all of it. And most observability platforms charge by ingested volume, including the health check logs nobody will ever query.

A telemetry pipeline is a layer between sources and destinations that decides, before ingestion, what’s worth keeping, where, and for how long.

The five operations of a pipeline

  1. Filter: drop what has no value (debug logs in production, health checks, unused metrics).
  2. Sample: keep a representative fraction, and 100% of what matters (errors, slow requests).
  3. Transform: standardize formats, remove sensitive data, enrich with metadata.
  4. Aggregate: turn thousands of log lines into a metric.
  5. Route: send each piece of data to the right destination: a “hot” tool for investigation, cheap object storage for long-term retention.

The tools

Tool Profile
OpenTelemetry Collector Open standard, native to OTLP, processors configurable with the OTTL language
Vector Open source, very efficient, transformations with the VRL language
Cribl Stream Commercial, visual interface, focused on security and observability logs, replay of archived data
Fluent Bit Lightweight, common as a log agent on Kubernetes

You don’t have to pick just one: a common setup uses lightweight agents on the nodes and a central pipeline for business rules.

Filtering noise in the OTel Collector

The filter processor drops data using conditions written in OTTL:

processors:
  filter/noise:
    error_mode: ignore
    traces:
      span:
        - 'attributes["url.path"] == "/healthz"'
        - 'attributes["url.path"] == "/metrics"'
    logs:
      log_record:
        - 'severity_number < SEVERITY_NUMBER_INFO'

That alone (dropping health checks and logs below INFO in production) usually cuts volume significantly for many services.

Removing sensitive data

Personal data in logs is a security risk and a compliance problem under privacy laws such as Brazil’s LGPD or the GDPR. The transform processor masks and removes fields before they leave your environment. In the example below, the regex masks a Brazilian taxpayer ID (CPF):

processors:
  transform/pii:
    error_mode: ignore
    log_statements:
      - context: log
        statements:
          - replace_pattern(body, "[0-9]{3}\\.[0-9]{3}\\.[0-9]{3}-[0-9]{2}", "***CPF***")
          - delete_key(attributes, "user.email")
          - delete_key(attributes, "http.request.header.authorization")

Ideally, of course, sensitive data is never logged at the source; the pipeline is the safety net.

Smart trace sampling (tail sampling)

Head sampling decides at the start of the request, without knowing whether it will fail. Tail sampling waits for the trace to finish and decides based on the outcome:

processors:
  tail_sampling:
    decision_wait: 10s
    policies:
      - name: errors
        type: status_code
        status_code: { status_codes: [ERROR] }
      - name: slow
        type: latency
        latency: { threshold_ms: 1000 }
      - name: sample-the-rest
        type: probabilistic
        probabilistic: { sampling_percentage: 5 }

The result: all traces with errors, all slow ones, and 5% of the rest. One important architectural detail: all spans of a trace must reach the same instance of the Collector. Use the loadbalancing exporter, routing by traceID, in a tier in front of the Collectors that do the sampling.

Vector: transforming and routing logs

Vector uses the VRL language to transform events. An example that parses JSON, removes a sensitive field, drops debug, and archives everything to S3:

[sources.app_logs]
type = "kubernetes_logs"

[transforms.clean]
type = "remap"
inputs = ["app_logs"]
source = '''
. = merge(., object!(parse_json(.message) ?? {}))
del(.user_email)
'''

[transforms.no_debug]
type = "filter"
inputs = ["clean"]
condition = '.level != "debug"'

[sinks.hot_tool]
type = "http"
inputs = ["no_debug"]
uri = "https://logs.your-backend.example.com/ingest"
encoding.codec = "json"

[sinks.s3_archive]
type = "aws_s3"
inputs = ["clean"]
bucket = "logs-archive"
region = "us-east-1"
key_prefix = "app/%Y/%m/%d/"
compression = "gzip"
encoding.codec = "json"

Notice the routing: the expensive tool receives the filtered logs; S3 receives everything (including debug) for a fraction of the cost.

Turning logs into metrics

Many log queries answer numeric questions: “how many payment errors per minute?”. Storing millions of lines to draw a chart is expensive. Generate the metric in the pipeline (with the count connector in the OTel Collector or the log_to_metric transform in Vector) and keep only a fraction of the raw logs.

Cheap storage + replay

The fear of dropping data is legitimate: “what if we need it during an incident?”. The answer is a combination:

  • A “hot” tool with filtered data and short retention for day-to-day investigation;
  • Object storage (S3, GCS, Azure Blob) with everything, compressed, and lifecycle rules;
  • The ability to replay a period from the archive into the hot tool when needed, a native feature in Cribl and doable with Vector or with the Collector itself.

The pipeline needs reliability too

If the pipeline goes down, you lose visibility exactly when you need it most. So:

  • Multiple replicas and autoscaling;
  • Persistent queues (disk buffers) to hold data while destinations fail;
  • Metrics for the pipeline itself: events received, dropped, errored, and exported;
  • Versioned configuration reviewed in PRs: a wrong filter rule can wipe out critical data.

Measuring the result

  • GB ingested per day, per service and per team (the basis for showback, as in unit economics);
  • Percentage dropped or sampled at each stage;
  • Cost per GB in the hot tool versus the archive;
  • Queries that required replay: if they’re frequent, filtering is too aggressive.

Checklist

  • Health checks and debug logs filtered in production
  • Sensitive data masked before it leaves the environment
  • Tail sampling keeping 100% of errors and slow requests
  • Metrics generated from high-volume logs
  • Routing: filtered hot tool, complete cheap archive
  • Pipeline with replicas, persistent buffers, and its own metrics
  • Volume and cost per service tracked

The cheapest data is the data you never ingest. The second cheapest is the data you store in the right place.

Get updates on new posts and stay in the loop!