diff --git a/cmd/kubevpn/cmds/logs.go b/cmd/kubevpn/cmds/logs.go index 677dc41b..4ba32343 100644 --- a/cmd/kubevpn/cmds/logs.go +++ b/cmd/kubevpn/cmds/logs.go @@ -58,6 +58,6 @@ func CmdLogs(f cmdutil.Factory) *cobra.Command { }, } cmd.Flags().BoolVarP(&req.Follow, "follow", "f", false, "Specify if the logs should be streamed.") - cmd.Flags().Int32VarP(&req.Lines, "number", "N", 10, "The location is number lines.") + cmd.Flags().Int32VarP(&req.Lines, "number", "N", 10, "Lines of recent log file to display.") return cmd } diff --git a/pkg/daemon/action/logs.go b/pkg/daemon/action/logs.go index 34668661..5784ea83 100644 --- a/pkg/daemon/action/logs.go +++ b/pkg/daemon/action/logs.go @@ -20,7 +20,11 @@ func (svr *Server) Logs(req *rpc.LogRequest, resp rpc.Daemon_LogsServer) error { } // only show latest N lines - lines -= req.Lines + if req.Lines < 0 { + lines = -req.Lines + } else { + lines -= req.Lines + } config := tail.Config{Follow: req.Follow, ReOpen: false, MustExist: true, Logger: log.New(io.Discard, "", log.LstdFlags)} if !req.Follow {