로그파일에 호스트이름 추가
This commit is contained in:
@ -93,7 +93,8 @@ func zipLogFiles(storageRoot string, req *shared.UploadRequest) (string, []strin
|
||||
}
|
||||
|
||||
root = path.Join(root, path.Dir(req.Filter))
|
||||
zipFileName := path.Join(os.TempDir(), path.Base(filepath.ToSlash(matches[0]))) + ".zip"
|
||||
hostname, _ := os.Hostname()
|
||||
zipFileName := path.Join(os.TempDir(), hostname+"_"+path.Base(filepath.ToSlash(matches[0]))) + ".zip"
|
||||
os.Remove(zipFileName)
|
||||
f, err := os.OpenFile(zipFileName, os.O_RDWR|os.O_CREATE|os.O_EXCL, 0600)
|
||||
|
||||
@ -537,11 +538,18 @@ func (hc *houstonClient) uploadFiles(req *shared.UploadRequest) error {
|
||||
if err == nil && len(zipFile) > 0 && len(srcFiles) > 0 {
|
||||
if err = hc.uploadZipLogFile(zipFile, child.name, child.version); err == nil {
|
||||
// 마지막거 빼고 삭제
|
||||
sort.StringSlice(srcFiles).Sort()
|
||||
for i := 0; i < len(srcFiles)-1; i++ {
|
||||
if len(srcFiles[i]) > 0 {
|
||||
if req.DeleteAfterUploaded == "true" {
|
||||
for i := 0; i < len(srcFiles)-1; i++ {
|
||||
os.Remove(srcFiles[i])
|
||||
}
|
||||
} else {
|
||||
sort.StringSlice(srcFiles).Sort()
|
||||
|
||||
for i := 0; i < len(srcFiles)-1; i++ {
|
||||
if len(srcFiles[i]) > 0 {
|
||||
os.Remove(srcFiles[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
logger.Println("uploadZipLogFile failed :", err)
|
||||
|
||||
Reference in New Issue
Block a user