Skip to content

Commit

Permalink
Fix audit log file permission and use date suffix in name (#181)
Browse files Browse the repository at this point in the history
Signed-off-by: Congqi Xia <[email protected]>
  • Loading branch information
congqixia authored Aug 10, 2023
1 parent 255b52b commit 6dace1c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion states/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"os"
"path"
"time"

"github.com/milvus-io/birdwatcher/configs"
"github.com/milvus-io/birdwatcher/framework"
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 6dace1c

Please sign in to comment.