Skip to content

[exporter/elasticsearch] Ability to specify the document ID for logs #36882

@mauri870

Description

@mauri870

Component(s)

exporter/elasticsearch

Is your feature request related to a problem? Please describe.

In Beats we are using the bodymap mapping mode to control the final document structure for logs. There is one thing we are unable to control with this approach, the final document ID. We use to control this ID for means of deduplicating messages as well as setting the id from a log field. For context, see https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-deduplication.html.

Describe the solution you'd like

We would like to have a way to tell the exporter to use a specific ID as the document identifier. The current implementation does not allow this and defaults to an autogenerated ID here. This might be a broader question for the collector in general, as we would like such functionality to be available from all the exporters.

Describe alternatives you've considered

One alternative is to consider a specific field in the log message body as the document id. For example in beats we use @metatada._id as the ID field, this @metadata field is then stripped out at our output layer (equivalent to an exporter in OTel) so we can use this information to set the ID properly in the final document.

Looking at the Logs model for OTel this would be equivalent to an Attribute. I imagine deduplication and the ability to set an identifier for the exported data is an interesting functionality that perhaps shoudn't be constrained to the elasticsearchexporter so I'm open to more general suggestions.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions