influxdata / influxdata/telegraf
Elasticsearch Output: Support using tag in template name
- Dominant language
- Go
- Stars
- 17.8k
- Forks
- 5.8k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 161
Description
## Feature Request
Opening a feature request kicks off a discussion.
### Proposal: Support using tag with notation `{{tag_name}}` in template name
### Current behavior: `index_name` supports using tag as part of the name. But `template_name` can only be hardcoded.
```ini
[global_tags]
monitor = "http"
[[outputs.elasticsearch]]
urls = [ "http://127.0.0.1:9200" ]
index_name = "telegraf-{{monitor}}-%Y.%m.%d"
template_name = "telegraf-http"
```
### Desired behavior: Both `index_name` and `template_name` support tag notation
```ini
[global_tags]
monitor = "http"
[[outputs.elasticsearch]]
urls = [ "http://127.0.0.1:9200" ]
index_name = "telegraf-{{monitor}}-%Y.%m.%d"
template_name = "telegraf-{{monitor}}"
```
### Use case:
When the `global_tags.monitor` is changed, the hardcoded `template_name = "telegraf-http"` may be forgotten.
If `template_name` supports tag reference, we only need to change the `global_tags.monitor` and the `template_name` will be modified automatically.
Contributor guide
Research direction
Start by locating the Elasticsearch output implementation and the existing handling of index_name and template_name. Trace how tag notation is expanded, then make template_name follow the same behavior and verify that the configuration examples produce matching names when the monitor tag changes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- elasticsearch, go
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100