Skip to content

Commit

Permalink
update the suggestion from yurishkuro
Browse files Browse the repository at this point in the history
Co-authored-by: Yuri Shkuro <[email protected]>
  • Loading branch information
WalkerWang731 and yurishkuro authored Apr 26, 2021
1 parent ff61a02 commit 29ca0e1
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions plugin/storage/es/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,15 +354,12 @@ func stripWhiteSpace(str string) string {
return strings.Replace(str, " ", "", -1)
}

func initDateLayout(rolloverBy, separator string) string {
seps := []interface{}{separator, separator}

// Default "day" index layout.
indexLayout := "2006%s01%s02"

if rolloverBy == "hour" {
indexLayout = "2006%s01%s02%s15"
seps = append(seps, separator)
}
return fmt.Sprintf(indexLayout, seps...)
func initDateLayout(rolloverFreq, sep string) string {
// default to daily format
indexLayout := "2006" + sep + "01" + sep + "02"
if rolloverFreq == "hour" {
indexLayout = indexLayout + sep + "15"
}
return indexLayout
}
}

0 comments on commit 29ca0e1

Please sign in to comment.