|
|
@ -19,8 +19,8 @@ import (
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
const (
|
|
|
|
rfc3339DateFormat = time.RFC3339
|
|
|
|
|
|
|
|
dateFormat = "2006-01-02"
|
|
|
|
dateFormat = "2006-01-02"
|
|
|
|
|
|
|
|
fileTimeFormat = time.RFC3339
|
|
|
|
hoursPerDay = 24
|
|
|
|
hoursPerDay = 24
|
|
|
|
bufferSize = 100
|
|
|
|
bufferSize = 100
|
|
|
|
defaultDirMode = 0o755
|
|
|
|
defaultDirMode = 0o755
|
|
|
@ -195,7 +195,7 @@ func (r *SizeLimitRotateRule) OutdatedFiles() []string {
|
|
|
|
|
|
|
|
|
|
|
|
// test if any too old backups
|
|
|
|
// test if any too old backups
|
|
|
|
if r.days > 0 {
|
|
|
|
if r.days > 0 {
|
|
|
|
boundary := time.Now().Add(-time.Hour * time.Duration(hoursPerDay*r.days)).Format(rfc3339DateFormat)
|
|
|
|
boundary := time.Now().Add(-time.Hour * time.Duration(hoursPerDay*r.days)).Format(fileTimeFormat)
|
|
|
|
boundaryFile := filepath.Join(dir, fmt.Sprintf("%s%s%s%s", prefix, r.delimiter, boundary, ext))
|
|
|
|
boundaryFile := filepath.Join(dir, fmt.Sprintf("%s%s%s%s", prefix, r.delimiter, boundary, ext))
|
|
|
|
if r.gzip {
|
|
|
|
if r.gzip {
|
|
|
|
boundaryFile += gzipExt
|
|
|
|
boundaryFile += gzipExt
|
|
|
@ -413,7 +413,7 @@ func getNowDate() string {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func getNowDateInRFC3339Format() string {
|
|
|
|
func getNowDateInRFC3339Format() string {
|
|
|
|
return time.Now().Format(rfc3339DateFormat)
|
|
|
|
return time.Now().Format(fileTimeFormat)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func gzipFile(file string) error {
|
|
|
|
func gzipFile(file string) error {
|
|
|
|