Bytes filter plugin

Parses storage-size strings such as 123 MB or 5.6gb and converts them into numeric byte values. Useful when upstream systems emit human-readable sizes that you need to query, chart, or alert on numerically.

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

Plugin overview

bytes is used in the Logstash filter stage. Parses storage-size strings such as 123 MB into bytes.

Typical use cases

  • Parse incoming log payloads into structured fields for querying and dashboards.
  • Transform fields before indexing to keep schema and naming consistent.

Input and output behavior

  • Flow: reads a configured source field and writes parsed/transformed output into a target or root fields.
  • Input field: source (default: .).
  • Output target: controlled by target.
  • Important options: source, target, conversion_method.

Options

Required

  • target (type: string) — Field where the numeric byte value will be written.

Optional

  • source (type: string; default: .) — Field that contains the human-readable size string.
  • conversion_method (type: string; default: binary) — Conversion base used when interpreting the size (binary for 1024-based units or decimal for 1000-based units).

Example configuration

filter {
  bytes {
    source => "[http][response][size_human]"
    target => "[http][response][size_bytes]"
    conversion_method => "binary"
  }
}

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 {
  bytes {
    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 bytes 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 bytes 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