|
@@ -245,14 +245,21 @@ func (m *fileSink) GetFws(ctx api.StreamContext, fn string, item interface{}) (*
|
|
}
|
|
}
|
|
nfn := fn
|
|
nfn := fn
|
|
if m.c.RollingNamePattern != "" {
|
|
if m.c.RollingNamePattern != "" {
|
|
|
|
+ newFile := ""
|
|
|
|
+ fileDir := filepath.Dir(fn)
|
|
|
|
+ fileName := filepath.Base(fn)
|
|
switch m.c.RollingNamePattern {
|
|
switch m.c.RollingNamePattern {
|
|
case "prefix":
|
|
case "prefix":
|
|
- nfn = fmt.Sprintf("%d-%s", conf.GetNowInMilli(), fn)
|
|
|
|
|
|
+ newFile = fmt.Sprintf("%d-%s", conf.GetNowInMilli(), fileName)
|
|
case "suffix":
|
|
case "suffix":
|
|
ext := filepath.Ext(fn)
|
|
ext := filepath.Ext(fn)
|
|
- nfn = fmt.Sprintf("%s-%d%s", strings.TrimSuffix(fn, ext), conf.GetNowInMilli(), ext)
|
|
|
|
|
|
+ newFile = fmt.Sprintf("%s-%d%s", strings.TrimSuffix(fileName, ext), conf.GetNowInMilli(), ext)
|
|
|
|
+ default:
|
|
|
|
+ newFile = fileName
|
|
}
|
|
}
|
|
|
|
+ nfn = filepath.Join(fileDir, newFile)
|
|
}
|
|
}
|
|
|
|
+
|
|
fws, e = createFileWriter(ctx, nfn, m.c.FileType, headers, m.c.Compression)
|
|
fws, e = createFileWriter(ctx, nfn, m.c.FileType, headers, m.c.Compression)
|
|
if e != nil {
|
|
if e != nil {
|
|
return nil, e
|
|
return nil, e
|