diff --git a/client/operation.go b/client/operation.go index 835e360..997d057 100644 --- a/client/operation.go +++ b/client/operation.go @@ -102,11 +102,12 @@ func zipLogFiles(storageRoot string, req *shared.UploadRequest, start, except st defer w.Close() oldestFile := "" - for _, file := range matches { + for i, file := range matches { if file == root { continue } if len(except) > 0 && file >= except { + matches = matches[:i] break } if len(start) > 0 && file < start { @@ -256,7 +257,11 @@ func (hc *houstonClient) launch(meta *procmeta) error { go func(startFile, nextFile string) { zipFile, srcFiles, err := zipLogFiles(hc.config.StorageRoot, req, startFile, nextFile) if err == nil && len(zipFile) > 0 && len(srcFiles) > 0 { - if err = hc.uploadZipLogFile(zipFile, meta.name, meta.version); err != nil { + if err = hc.uploadZipLogFile(zipFile, meta.name, meta.version); err == nil { + for _, oldf := range srcFiles { + os.Remove(oldf) + } + } else { logger.Println("uploadZipLogFile failed :", err) } } else if err != nil {