hotfix: fix log rotate (#287)

This commit is contained in:
naison
2024-07-05 21:59:33 +08:00
committed by GitHub
parent d2648aabed
commit d2faffc2c7

View File

@@ -1,6 +1,9 @@
package action
import (
"io"
"log"
"github.com/hpcloud/tail"
"github.com/wencaiwulue/kubevpn/v2/pkg/daemon/rpc"
@@ -8,7 +11,7 @@ import (
func (svr *Server) Logs(req *rpc.LogRequest, resp rpc.Daemon_LogsServer) error {
path := GetDaemonLogPath()
config := tail.Config{Follow: req.Follow, ReOpen: true, MustExist: true}
config := tail.Config{Follow: req.Follow, ReOpen: false, MustExist: true, Logger: log.New(io.Discard, "", log.LstdFlags)}
if !req.Follow {
// FATAL -- cannot set ReOpen without Follow.
config.ReOpen = false