'how to use logstash input elasticsarch index dynamic value
Please help me.
What I want is to know how to dynamically change the index during logstash elasticsearch input.
i want this
input {
elasticsearch {
hosts => localhost:9200
index => index-+{yyyy}-{increasing value}
}
}
result
input {
elasticsearch {
hosts => localhost:9200
index => index-2022-52
}
}
I need to be able to set the value to change every day.
ex) Using Linux scripts
Thank you in advance for your help.
Solution 1:[1]
You can leverage environment variables.
Your input configuration would look like this:
input {
elasticsearch {
hosts => localhost:9200
index => index-${YEAR}-${SEQ}
}
}
And then set those variables from your shell just before running Logstash
export YEAR=2022
export SEQ=52
./bin/logstash -f test.conf
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Val |
