From 811eb6f0d6560b09fa683d37273f4baa02065dc6 Mon Sep 17 00:00:00 2001 From: zhangqianze Date: Wed, 16 Oct 2024 16:45:35 -0700 Subject: [PATCH] feat: fix property.json & log file pattern to include channel name --- server/internal/http_server.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server/internal/http_server.go b/server/internal/http_server.go index d7c41915..da39d05b 100644 --- a/server/internal/http_server.go +++ b/server/internal/http_server.go @@ -13,6 +13,7 @@ import ( "log/slog" "mime/multipart" "net/http" + "net/url" "os" "path/filepath" "strings" @@ -460,10 +461,9 @@ func (s *HttpServer) processProperty(req *StartReq) (propertyJsonFile string, lo } } - channelNameMd5 := gmd5.MustEncryptString(req.ChannelName) - ts := time.Now().UnixNano() - propertyJsonFile = fmt.Sprintf("%s/property-%s-%d.json", s.config.LogPath, channelNameMd5, ts) - logFile = fmt.Sprintf("%s/app-%s-%d.log", s.config.LogPath, channelNameMd5, ts) + ts := time.Now().Format("20060102_150405_000") + propertyJsonFile = fmt.Sprintf("%s/property-%s-%s.json", s.config.LogPath, url.QueryEscape(req.ChannelName), ts) + logFile = fmt.Sprintf("%s/app-%s-%s.log", s.config.LogPath, url.QueryEscape(req.ChannelName), ts) os.WriteFile(propertyJsonFile, []byte(propertyJson), 0644) return