I was trying to use a version number in my stats index like this:
stats-index-format = "my_index_2_2006-01-01"
but that produces an index named "my_index_10_2025-10-10"
package main
import (
"fmt"
"strings"
"time"
)
func main() {
t := time.Now().UTC()
index := strings.ToLower(t.Format("my_index_2_2006-01-01")) // changes the 2 to the current month
fmt.Print(index)
}
I don't believe it's possible to provide an escape sequence for a number using t.Format -- perhaps a potential enhancement would be to split stats-index-format in to 2 different settings and use something like this to accommodate that use case:
package main
import (
"fmt"
"time"
)
func main() {
t := time.Now().UTC()
index := fmt.Sprintf("my_index_2_%s", t.Format("2006-01-02"))
fmt.Println(index)
}