Update the Logstash output doc with guidance on using a single ES output - #8203
vishaangelova wants to merge 3 commits into
Conversation
Elastic Docs AI PR menuCheck the box to run an AI review for this pull request.
Powered by GitHub Agentic Workflows and docs-actions. For more information, reach out to the docs team. |
🔍 Preview links for changed docs |
Elastic Docs Style Checker (Vale)Summary: 10 warnings, 1 suggestion found
|
| File | Line | Rule | Message |
|---|---|---|---|
| reference/fleet/logstash-output.md | 96 | Elastic.MenuArrows | Use '→' to separate menu items, not '' or '='. Example: Select Manage index → Add lifecycle policy. |
| reference/fleet/logstash-output.md | 96 | Elastic.MenuArrows | Use '→' to separate menu items, not '' or '='. Example: Select Manage index → Add lifecycle policy. |
| reference/fleet/logstash-output.md | 103 | Elastic.MenuArrows | Use '→' to separate menu items, not '' or '='. Example: Select Manage index → Add lifecycle policy. |
| reference/fleet/logstash-output.md | 103 | Elastic.QuotesPunctuation | Place punctuation inside closing quotation marks. |
| reference/fleet/logstash-output.md | 104 | Elastic.MenuArrows | Use '→' to separate menu items, not '' or '='. Example: Select Manage index → Add lifecycle policy. |
| reference/fleet/logstash-output.md | 105 | Elastic.MenuArrows | Use '→' to separate menu items, not '' or '='. Example: Select Manage index → Add lifecycle policy. |
| reference/fleet/logstash-output.md | 106 | Elastic.MenuArrows | Use '→' to separate menu items, not '' or '='. Example: Select Manage index → Add lifecycle policy. |
| reference/fleet/logstash-output.md | 107 | Elastic.MenuArrows | Use '→' to separate menu items, not '' or '='. Example: Select Manage index → Add lifecycle policy. |
| reference/fleet/logstash-output.md | 108 | Elastic.MenuArrows | Use '→' to separate menu items, not '' or '='. Example: Select Manage index → Add lifecycle policy. |
| reference/fleet/logstash-output.md | 109 | Elastic.MenuArrows | Use '→' to separate menu items, not '' or '='. Example: Select Manage index → Add lifecycle policy. |
💡 Suggestions (1): Optional style improvements. Apply when helpful.
| File | Line | Rule | Message |
|---|---|---|---|
| reference/fleet/logstash-output.md | 104 | Elastic.Ellipses | Use ellipses sparingly. Remove the ellipsis unless it appears in UI text. |
The Vale linter checks documentation changes against the Elastic Docs style guide. To use Vale locally or report issues, refer to Elastic style guide for Vale.
Co-authored-by: Cursor <cursoragent@cursor.com>
8ce2dc1 to
c2cde99
Compare
|
@robbavey, could you or someone from your team have a look at the changes in this PR? Thanks! |
lucabelluccini
left a comment
There was a problem hiding this comment.
I think a Logstash developer should review this. We are relying on [@metadata][_ingest_document][id] which is not really well publicly documented.
| ```yaml | ||
| filter { | ||
| mutate { | ||
| copy => { "[@metadata][_id]" => "[@metadata][_ingest_document][id]" } |
There was a problem hiding this comment.
I do not know if we should protect this copy by if [@metadata][_id] { ...
| `[@metadata][_ingest_document][id]` is read internally by the {{es}} output plugin and is not part of that plugin's documented configuration surface. Keep two things in mind when you use it: | ||
|
|
||
| * Don't also set `document_id` on the output. An explicit `document_id` overrides the metadata field. | ||
| * If your pipeline also uses the [`elastic_integration` filter](logstash-docs-md://lsr/plugins-filters-elastic_integration.md), add the `mutate` after that filter. The filter replaces the whole `[@metadata][_ingest_document]` map, so an earlier `copy` is discarded. |
There was a problem hiding this comment.
If one uses the elastic_integration for all the events, the mutate is un-necessary.
If one uses the elastic_integration only on a part of the data, then we would need something like this (pseudocode):
if [... criteria to use elastic_integration] {
elastic_integration {
...
}
} else {
// Here we have the events which are not processed by elastic_integration
mutate {
copy => { "[@metadata][_id]" => "[@metadata][_ingest_document][id]" }
}
}
There was a problem hiding this comment.
I used Claude to research this a bit. It checked logstash-filter-elastic_integration and logstash-output-elasticsearch at HEAD, and flagged the following:
The filter does not copy Agent
[@metadata][_id]into[@metadata][_ingest_document][id]. It writes that field only when the ingest pipeline sets_id, and it replaces the whole_ingest_documentmap, so amutatebefore the filter is discarded. The Elasticsearch output reads_ingest_document[id], not[@metadata][_id].So omitting
mutatewhen every event goes through the filter would drop Agent IDs unless the ingest pipeline also set_id. An unconditional copy after the filter would overwrite an ID the pipeline did set.
Updated in 3996c3b: the section now uses one condition that covers both cases.
|
@vishaangelova @lucabelluccini Let's chat about this |
Summary
This PR adds a Use a single Elasticsearch output section documenting an alternative to the dual-output example in the Fleet Logstash output doc.
Closes #7854
Verification
Used Claude to check against
logstash-plugins/logstash-output-elasticsearchatHEAD:data_stream_event_action_tuplecalls the samecommon_event_params, which reads[@metadata][_ingest_document], so this works withdata_stream => true.resolve_document_idprefers an explicitdocument_id, so the two must not be combined. Documented as a caveat.elastic_integrationfilter replaces the whole[@metadata][_ingest_document]map viaevent.setField, so themutatemust come after it. Also documented.Reviewer note
[@metadata][_ingest_document][id]is documented as an output of theelastic_integrationfilter, but the Elasticsearch output plugin's docs never mention that it consumes the field. Documenting it here makes an internal contract semi-public, so I'd like a Logstash maintainer (cc @robbavey, per the issue) to confirm this is acceptable before merge.A follow-up PR will apply the same treatment to
docs/reference/filebeat/filebeat-deduplication.mdinelastic/beats, which carries the identical dual-output pattern.Generative AI disclosure
Tool(s) and model(s) used: Cursor (Claude Opus 5)