diff --git a/states/instance.go b/states/instance.go index 8b49b09..2b523f5 100644 --- a/states/instance.go +++ b/states/instance.go @@ -5,6 +5,7 @@ import ( "fmt" "os" "path" + "time" "github.com/milvus-io/birdwatcher/configs" "github.com/milvus-io/birdwatcher/framework" @@ -119,7 +120,8 @@ func (s *InstanceState) DryModeCommand(ctx context.Context, p *DryModeParam) { func getInstanceState(parent *framework.CmdState, cli clientv3.KV, instanceName, metaPath string, etcdState framework.State, config *configs.Config) framework.State { var kv clientv3.KV - file, err := os.OpenFile("audit.log", os.O_APPEND|os.O_CREATE|os.O_WRONLY, os.ModeAppend) + name := fmt.Sprintf("audit_%s.log", time.Now().Format("2006_0102_150405")) + file, err := os.OpenFile(name, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644) if err != nil { fmt.Println("failed to open audit.log file!") kv = cli