Throttle filter plugin

Rate-limits events that share a key inside a rolling time window. Combine it with drop or a tag to mute floods of repetitive events without losing visibility entirely.

  • Package: logstash-filter-throttle
  • Coverage source: default/bundled
  • Official catalog entry: Yes

Plugin overview

throttle is used in the Logstash filter stage. Rate-limits events by key and period.

Typical use cases

  • Transform fields before indexing to keep schema and naming consistent.
  • Prepare high-quality fields for alerts, dashboards, and downstream pipelines.

Input and output behavior

  • Flow: processes matching events and mutates fields/tags within the same event.
  • Input: works on events that match your surrounding if conditions.
  • Output: updates the current event in place unless configured otherwise.
  • Important options: key, after_count, before_count, max_age.

Options

Required

  • key (type: string; default: none) — Sprintf expression that produces the throttle key (events sharing a key count together).

Optional

  • after_count (type: number; default: -1) — Tag events only after the count exceeds this threshold.
  • before_count (type: number; default: -1) — Tag events only before the count reaches this threshold.
  • max_age (type: number; default: 3600) — Maximum age of a counter before it is discarded.
  • max_counters (type: number; default: 100000) — Cap on the number of distinct counters kept in memory.
  • period (type: string; default: "60") — Length of the rolling window, in seconds.

Example configuration

filter {
  throttle {
    key         => "%{[log][level]}|%{[service][name]}"
    period      => 60
    after_count => 50
    add_tag     => [ "throttled" ]
  }
 
  if "throttled" in [tags] {
    drop { }
  }
}

Common options configuration

All Logstash filter plugins support these shared options:

  • add_field (type: hash; default: {}) — Adds fields when the filter succeeds. Supports dynamic field names and values.
  • add_tag (type: array; default: []) — Adds one or more tags when the filter succeeds.
  • enable_metric (type: boolean; default: true) — Enables or disables metric collection for this plugin instance.
  • id (type: string; default: none) — Sets an explicit plugin instance ID for monitoring and troubleshooting.
  • periodic_flush (type: boolean; default: false) — Calls the filter flush method at regular intervals.
  • remove_field (type: array; default: []) — Removes fields when the filter succeeds. Supports dynamic field names.
  • remove_tag (type: array; default: []) — Removes tags when the filter succeeds.
filter {
  throttle {
    add_field => { "pipeline_stage" => "parsed" }
    add_tag => ["parsed", "logstash_filter"]
    enable_metric => true
    id => "my_filter_instance"
    periodic_flush => false
    remove_field => ["tmp_field"]
    remove_tag => ["temporary"]
  }
}

Apply in Logit.io

  1. Open your stack in Logit.io and navigate to Logstash Pipelines.
  2. In the filter { ... } section, add a throttle block.
  3. Save your pipeline changes, then restart the Logstash pipeline if prompted.
  4. Send sample events and verify parsed/enriched fields in OpenSearch Dashboards.

Validation checklist

  • Confirm the throttle block compiles without syntax errors.
  • Verify expected new/updated fields exist in sample documents.
  • Verify unexpected fields are not removed unless explicitly configured.
  • Confirm tags added on success/failure align with your alerting and routing rules.

Troubleshooting

  • If events are unchanged, verify your filter condition (if ...) matches incoming events.
  • If the pipeline fails to start, validate braces/quotes and retry with a minimal filter block.
  • If throughput drops, reduce expensive operations and test with representative sample volume.

References