Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

velero --log_file store #5371

Closed
ghost opened this issue Sep 21, 2022 Discussed in #5369 · 6 comments · Fixed by #5396
Closed

velero --log_file store #5371

ghost opened this issue Sep 21, 2022 Discussed in #5369 · 6 comments · Fixed by #5396
Assignees
Labels
Area/CLI related to the command-line interface Needs investigation
Milestone

Comments

@ghost
Copy link

ghost commented Sep 21, 2022

Discussed in #5369

Originally posted by cuishuyuanCode September 21, 2022
when i use
velero backup logs xxxx --log_file /var/log/test.log
i can see the backup logs,but i cann't get the log file.
what shoud i do?

@cleverhu
Copy link
Contributor

You can use velero backup download backup-xxx --target-kind=BackupLog to download the log file when this pr is merged. #5378

@cleverhu
Copy link
Contributor

And I checked the code, the arg log_file is not supported. I will try to fix it.

@ghost
Copy link
Author

ghost commented Sep 23, 2022

And I checked the code, the arg log_file is not supported. I will try to fix it.

ok,thanks

@ywk253100
Copy link
Contributor

@cleverhu Thanks for the comment.

Most of the flags of Global Flags are used to get logs from client-go/apimachinery according to the comment, they are not designed to work with Velero command itself.

But as we are moving to kubebuilder/controller runtime framework, we need to investigate whether these flags are still needed or not.
And I also noticed client-go/apimachinery uses klog/v2 while Velero still references the v1 version.

Global Flags:
      --add_dir_header                   If true, adds the file directory to the header
      --alsologtostderr                  log to standard error as well as files
      --colorized optionalBool           Show colored output in TTY. Overrides 'colorized' value from $HOME/.config/velero/config.json if present. Enabled by default
      --features stringArray             Comma-separated list of features to enable for this Velero process. Combines with values from $HOME/.config/velero/config.json if present
      --kubeconfig string                Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration
      --kubecontext string               The context to use to talk to the Kubernetes apiserver. If unset defaults to whatever your current-context is (kubectl config current-context)
      --log_backtrace_at traceLocation   when logging hits line file:N, emit a stack trace (default :0)
      --log_dir string                   If non-empty, write log files in this directory
      --log_file string                  If non-empty, use this log file
      --log_file_max_size uint           Defines the maximum size a log file can grow to. Unit is megabytes. If the value is 0, the maximum file size is unlimited. (default 1800)
      --logtostderr                      log to standard error instead of files (default true)
  -n, --namespace string                 The namespace in which Velero should operate (default "velero")
      --skip_headers                     If true, avoid header prefixes in the log messages
      --skip_log_headers                 If true, avoid headers when opening log files
      --stderrthreshold severity         logs at or above this threshold go to stderr (default 2)
  -v, --v Level                          number for the log level verbosity
      --vmodule moduleSpec               comma-separated list of pattern=N settings for file-filtered logging

@ywk253100 ywk253100 added Needs investigation Area/CLI related to the command-line interface labels Sep 26, 2022
@ywk253100 ywk253100 self-assigned this Sep 26, 2022
@ywk253100 ywk253100 added this to the 1.10 milestone Sep 26, 2022
@reasonerjt
Copy link
Contributor

Let's try to make the global flag effective for klog/v2 before v1.10 RC

@blackpiglet
Copy link
Contributor

After updating Velero using klog version, the velero global flags should work.
During my test, to make --log_file parameter work, need to set --logtostderr=false as well. kubernetes/klog#103 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area/CLI related to the command-line interface Needs investigation
Projects
None yet
4 participants