JSON filter plugin

Parses a JSON-encoded string stored in a field and promotes its keys into structured event fields. This is the standard way to unpack events that arrive as a single JSON blob inside message.

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

Plugin overview

json is used in the Logstash filter stage. Parses JSON content from source fields into event fields.

Typical use cases

  • Decode JSON payloads stored in message or another source field.
  • Promote parsed JSON fields into searchable OpenSearch document fields.

Input and output behavior

  • Flow: Parses JSON from an input field and writes decoded keys to root or target.
  • Input field: source.
  • Output target: controlled by target.
  • Important options: source, target, tag_on_failure, ecs_compatibility.
  • Failure signaling: uses tag_on_failure (default: ["_jsonparsefailure"]) so failed events can be routed or inspected.

Options

Required

  • source (type: string; default: none) — Field containing the JSON string to parse.

Optional

  • ecs_compatibility (type: string) — Controls ECS field compatibility behaviour (disabled, v1, or v8).
  • skip_on_invalid_json (type: boolean; default: false) — When true, invalid JSON does not add a parse-failure tag.
  • tag_on_failure (type: array; default: ["_jsonparsefailure"]) — Tags applied when the source is not valid JSON.
  • target (type: string; default: none) — Parent field to nest the parsed keys under (omit to write to the event root).

Example configuration

filter {
  json {
    source => "message"
    target => "payload"
    skip_on_invalid_json => false
    tag_on_failure => [ "_jsonparsefailure" ]
  }
}

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 {
  json {
    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 json 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 json 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.
  • Check for tag_on_failure tags (default: ["_jsonparsefailure"]) to quickly isolate parse/mutation failures.
  • If throughput drops, reduce expensive operations and test with representative sample volume.

References