Logstash Mutate Filter Design Prompt
Design a correct, ordered Logstash mutate filter for renaming, converting, trimming, and reshaping fields — respecting mutate's fixed operation order to avoid subtle transform bugs.
- Target user
- Observability engineers normalizing event fields in the Elastic Stack
- Difficulty
- Intermediate
- Tools
- Claude, ChatGPT, Cursor
The prompt
You are a senior Elastic Stack engineer who designs Logstash `mutate` filters to normalize event schemas. I will provide: - Sample events (the current field names, types, and values after parsing) - The target schema / naming convention (e.g. ECS field names and types) - Which fields to keep, rename, convert, split, or drop Your job: 1. **Map the transform** — list every field-level change needed: rename, convert (type coercion), gsub (regex cleanup), split, strip, lowercase/uppercase, replace/update, merge, copy, add_field, remove_field. 2. **Respect operation order** — Logstash mutate runs operations in a fixed precedence regardless of how you write them; identify where that ordering would break your intent (e.g. converting a field you also rename) and split into multiple sequential `mutate` blocks so each step sees the prior result. 3. **Type safety** — use `convert` for int/float/boolean coercion and note failure behavior on non-coercible values; recommend a guard conditional for fields that may be absent. 4. **ECS alignment** — where relevant, rename to ECS field names and place under the correct nested objects (`[host][name]`, `[source][ip]`), being explicit about nested-field syntax. 5. **Cleanup** — remove parsing artifacts, tags, and the raw `message` where no longer needed, and prune empty/null fields. 6. **Idempotency** — ensure re-running the pipeline on the same event is safe (no double-splits or repeated gsub). Output as: (a) the mutate config(s) in correct execution order, (b) a before/after field table, (c) notes on why blocks were split, (d) sample event in/out for validation. Ask for representative events that include the messy/edge cases before finalizing.
Run this prompt with AI
Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.
Related prompts
-
Logstash Conditional Routing & Tags Prompt
Design clean conditional logic and tagging in the Logstash filter section to branch parsing by event type, quarantine parse failures, and drive downstream routing — without fragile nested if/else.
-
Logstash Date Filter & Timezone Prompt
Design a Logstash date filter that parses event timestamps into @timestamp correctly across timezones, formats, and locales — eliminating time-skew, off-by-hours, and DST bugs in Kibana.
-
Logstash Dissect Filter Design Prompt
Design a Logstash dissect filter for fast, deterministic parsing of well-structured delimited logs — and know exactly when to prefer dissect over grok for throughput and clarity.
-
Logstash GeoIP Enrichment Prompt
Design a Logstash geoip filter that enriches IP fields with geolocation and ASN data reliably — handling private IPs, database freshness, ECS field targets, and lookup failures.
More Logstash prompts & error guides
Browse every Logstash prompt and troubleshooting guide in one place.
Reading prompts? Get all 500 in one free PDF
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.