Setting the elasticsearch index dynamically #36021
Unanswered
paulevanmr
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi all,
I'm trying to do something that I thought would be pretty simple but can't get it working.
Effectively I am trying to do a transform to set my index to be metrics-envrionment so that in kibana it's easy to view data for a particular environment.
For our dev environment and local environments we funnel metrics/logs to a shared instance so when the environment is "local" I am overriding it with the host name:
`
metric_statements:
- context: resource
statements:
- set(attributes["host.id"], "${ComputerName}")
This is how I am setting my deployment.environment.name and this works as expected but now I want to go one step further and do something along these lines:
- set(attributes["elasticsearch.index"],Concat("metrics-",attributes["deployment.environment.name"]))
The error I'm getting implies that it's an issue with the concat method. I've tried so many different ways of doing this but to no avail so I'd appreciate anyone being able to point me in the right direction!
2024-10-28 11:23:09 2024/10/28 11:23:09 collector server run finished with error: invalid configuration: processors::transform: unable to parse OTTL statement "set(attributes["elasticsearch.index"],Concat("metrics-",attributes["deployment.environment.name"]))": error while parsing arguments for call to "set": invalid argument at position 1: error while parsing arguments for call to "Concat": invalid argument at position 0: must be a list of type StringLikeGetter[github.com/open-telemetry/opentelemetry-collector-contrib/pkg/ottl/contexts/ottlresource.TransformContext]
Beta Was this translation helpful? Give feedback.
All reactions