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

Add Dynamic index #34746

Open
flenoir opened this issue Aug 20, 2024 · 3 comments
Open

Add Dynamic index #34746

flenoir opened this issue Aug 20, 2024 · 3 comments

Comments

@flenoir
Copy link

flenoir commented Aug 20, 2024

Component(s)

exporter/opensearch

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

I was using elasticsearch before but now i moved to opensearch. I wanted to use same dynamic index feature in order to create index per day.
Unfortunately not possible with opensearch exporter. Will it be added in the futur ?

Describe the solution you'd like

adding dynamic index like in elasticsearch exporter

Describe alternatives you've considered

Is there another way to add this daily rotation in order to have index like "my_index-20608-2024" for example

Thanks

Additional context

none

@flenoir flenoir added enhancement New feature or request needs triage New item requiring triage labels Aug 20, 2024
Copy link
Contributor

Pinging code owners:

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

@JaredTan95
Copy link
Member

you meaning logstash_format feature in elasticsearchexporter?

@codingbott
Copy link

codingbott commented Nov 14, 2024

you meaning logstash_format feature in elasticsearchexporter?

He is also talking about defining the name of datastream created by the exporter.
He expects that the opensearch exporter has the same feature as ElasticSearch exporter.
In that one you can build a dynamic index name according to attributes from the log record.

I'm using that feature to specify the index to write the log to, from the oidc token.

Take a look here, please: https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/exporter/elasticsearchexporter/README.md
Search for "logs_dynamic_index".

here is the extract of that:

  • logs_dynamic_index (optional): uses resource, scope, or log record attributes to dynamically construct index name.
    • enabled(default=false): Enable/Disable dynamic index for log records. If data_stream.dataset or data_stream.namespace exist in attributes (precedence: log record attribute > scope attribute > resource attribute), they will be used to dynamically construct index name in the form logs-${data_stream.dataset}-${data_stream.namespace}. Otherwise, if
      elasticsearch.index.prefix or elasticsearch.index.suffix exist in attributes (precedence: resource attribute > scope attribute > log record attribute), they will be used to dynamically construct index name in the form ${elasticsearch.index.prefix}${logs_index}${elasticsearch.index.suffix}. Otherwise, if scope name matches regex /receiver/(\w*receiver), data_stream.dataset will be capture group Create CODEOWNERS #1. Otherwise, the index name falls back to logs-generic-default, and logs_index config will be ignored. Except for prefix/suffix attribute presence, the resulting docs will contain the corresponding data_stream.* fields, see restrictions applied to Data Stream Fields.

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

4 participants