Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mauri870 opened this issue Dec 18, 2024 · 2 comments
Open

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

mauri870 opened this issue Dec 18, 2024 · 2 comments

Comments

@mauri870
Copy link
Contributor

mauri870 commented Dec 18, 2024

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. 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 is an interesting functionality that perhaps shoudn't be constrained to the bodymap mapping mode or the elasticsearchexporter so I'm open to more general suggestions.

Additional context

No response

@mauri870 mauri870 added enhancement New feature or request needs triage New item requiring triage labels Dec 18, 2024
Copy link
Contributor

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

@mauri870 mauri870 changed the title [exporter/elasticsearch] Ability to specify the document ID [exporter/elasticsearch] Ability to specify the document ID for logs Dec 18, 2024
@VihasMakwana
Copy link
Contributor

VihasMakwana commented Dec 18, 2024

This sounds like a valid enhancement to me.
We can probably have something like log_dynamic_index, to allow setting _id from attributes.

Let's see what the code owners have to say about this.

@VihasMakwana VihasMakwana added waiting-for-code-owners and removed needs triage New item requiring triage labels Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants