diff --git a/idxmgmt/ilm/config.go b/idxmgmt/ilm/config.go index 9a3b76bd68f..adde417d2ab 100644 --- a/idxmgmt/ilm/config.go +++ b/idxmgmt/ilm/config.go @@ -19,6 +19,7 @@ package ilm import ( "fmt" + "strings" "time" libcommon "github.com/elastic/beats/v7/libbeat/common" @@ -125,7 +126,7 @@ func (m *Mappings) Unpack(cfg *libcommon.Config) error { mapping.Index = existing.Index } if mapping.IndexSuffix != "" { - mapping.Index = fmt.Sprintf("%s-%s", mapping.Index, mapping.IndexSuffix) + mapping.Index = fmt.Sprintf("%s-%s", mapping.Index, strings.ToLower(mapping.IndexSuffix)) } (*m)[mapping.EventType] = mapping } diff --git a/idxmgmt/ilm/config_test.go b/idxmgmt/ilm/config_test.go index f848f83466a..1732fb345bf 100644 --- a/idxmgmt/ilm/config_test.go +++ b/idxmgmt/ilm/config_test.go @@ -118,7 +118,7 @@ func TestConfig_Valid(t *testing.T) { expected Config }{ {name: "new policy and index suffix", - cfg: `{"setup":{"mapping":[{"event_type":"span","policy_name":"spanPolicy"},{"event_type":"metric","index_suffix":"production"},{"event_type":"error","index_suffix":"%{[observer.name]}"}],"policies":[{"name":"spanPolicy","policy":{"phases":{"foo":{}}}}]}}`, + cfg: `{"setup":{"mapping":[{"event_type":"span","policy_name":"spanPolicy"},{"event_type":"metric","index_suffix":"ProdUCtion"},{"event_type":"error","index_suffix":"%{[observer.name]}"}],"policies":[{"name":"spanPolicy","policy":{"phases":{"foo":{}}}}]}}`, expected: Config{Mode: libilm.ModeAuto, Setup: Setup{Enabled: true, Overwrite: false, RequirePolicy: true, Mappings: map[string]Mapping{ @@ -129,7 +129,7 @@ func TestConfig_Valid(t *testing.T) { "transaction": {EventType: "transaction", PolicyName: defaultPolicyName, Index: "apm-9.9.9-transaction"}, "metric": {EventType: "metric", PolicyName: defaultPolicyName, - Index: "apm-9.9.9-metric-production", IndexSuffix: "production"}, + Index: "apm-9.9.9-metric-production", IndexSuffix: "ProdUCtion"}, "profile": {EventType: "profile", PolicyName: defaultPolicyName, Index: "apm-9.9.9-profile"}, },