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

Add --file flag to 'minikube logs' to automatically put logs into a file. #11240

Merged
merged 4 commits into from
May 6, 2021

Conversation

andriyDev
Copy link
Contributor

@andriyDev andriyDev commented Apr 30, 2021

fixes #11231.

Before:

$ minikube logs

==> Audit <==
|---------------|--------------------------------------------|----------|-------------|---------|-------------------------------|-------------------------------|
|    Command    |                    Args                    | Profile  |    User     | Version |          Start Time           |           End Time            |
|---------------|--------------------------------------------|----------|-------------|---------|-------------------------------|-------------------------------|
| generate-docs | --path ./site/content/en/docs/commands/    | minikube | andriydzikh | v1.19.0 | Thu, 29 Apr 2021 13:58:18 PDT | Thu, 29 Apr 2021 13:58:18 PDT |
|               | --test-path                                |          |             |         |                               |                               |
|               | ./site/content/en/docs/contrib/tests.en.md |          |             |         |                               |                               |
| start         |                                            | minikube | andriydzikh | v1.19.0 | Thu, 29 Apr 2021 14:06:56 PDT | Thu, 29 Apr 2021 14:08:05 PDT |
... Continued

After:

andriydzikh@andriydzikh-glaptop:~/minikube$ minikube logs --file f

After file:

* 
* ==> Audit <==
* |---------------|--------------------------------------------|----------|-------------|---------|-------------------------------|-------------------------------|
|    Command    |                    Args                    | Profile  |    User     | Version |          Start Time           |           End Time            |
|---------------|--------------------------------------------|----------|-------------|---------|-------------------------------|-------------------------------|
| generate-docs | --path ./site/content/en/docs/commands/    | minikube | andriydzikh | v1.19.0 | Thu, 29 Apr 2021 13:58:18 PDT | Thu, 29 Apr 2021 13:58:18 PDT |
|               | --test-path                                |          |             |         |                               |                               |
|               | ./site/content/en/docs/contrib/tests.en.md |          |             |         |                               |                               |
| start         |                                            | minikube | andriydzikh | v1.19.0 | Thu, 29 Apr 2021 14:06:56 PDT | Thu, 29 Apr 2021 14:08:05 PDT |
... Continued

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Apr 30, 2021
@k8s-ci-robot
Copy link
Contributor

Hi @andriyDev. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Apr 30, 2021
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Apr 30, 2021
@minikube-bot
Copy link
Collaborator

Can one of the admins verify this patch?

@andriyDev andriyDev requested a review from medyagh April 30, 2021 22:51
@spowelljr
Copy link
Member

@andriyDev Run make generate-docs to update the --file flag in the docs.

@andriyDev
Copy link
Contributor Author

@spowelljr Done!

@medyagh
Copy link
Member

medyagh commented May 3, 2021

@andriyDev so -file will still output to the console ? I would rather the -file only write to a file and let user's console be clean

@andriyDev
Copy link
Contributor Author

@andriyDev so -file will still output to the console ? I would rather the -file only write to a file and let user's console be clean

@medyagh No, the console is clean when using --file. Errors however will still output to the console though (e.g. permission denied). This way users can see any issues resulting from the actual logging process and not have that be tied into the log file.

cmd/minikube/cmd/logs.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels May 4, 2021
var err error

if fileOutput != "" {
logOutput, err = os.Create(fileOutput)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So are we expecting an absolute or relative path here? Enforcing one or the other will make things less confusing for the user.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can be either. Isn't it standard to allow both relative and absolute paths for file parameters?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should allow user both, I image I would wanna do

minikube logs -f ~/Desktop/m.log

or

minikube logs -f /tmp/m.log

@medyagh
Copy link
Member

medyagh commented May 5, 2021

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels May 5, 2021
@minikube-pr-bot
Copy link

kvm2 driver with docker runtime

+----------------+----------+---------------------+
|    COMMAND     | MINIKUBE | MINIKUBE (PR 11240) |
+----------------+----------+---------------------+
| minikube start | 53.1s    | 51.8s               |
| enable ingress | 38.6s    | 40.0s               |
+----------------+----------+---------------------+

Times for minikube ingress: 43.2s 36.7s 34.9s 35.4s 42.9s
Times for minikube (PR 11240) ingress: 43.8s 35.8s 42.3s 35.4s 42.9s

Times for minikube start: 54.1s 53.8s 51.8s 53.2s 52.6s
Times for minikube (PR 11240) start: 51.0s 55.2s 50.3s 50.8s 51.6s

docker driver with docker runtime

+----------------+----------+---------------------+
|    COMMAND     | MINIKUBE | MINIKUBE (PR 11240) |
+----------------+----------+---------------------+
| minikube start | 22.2s    | 22.3s               |
| enable ingress | 33.2s    | 34.2s               |
+----------------+----------+---------------------+

Times for minikube ingress: 36.5s 33.5s 33.0s 30.0s 33.0s
Times for minikube (PR 11240) ingress: 36.5s 33.5s 31.5s 35.0s 34.5s

Times for minikube start: 22.1s 22.0s 22.5s 22.3s 21.9s
Times for minikube (PR 11240) start: 22.2s 22.2s 22.6s 22.1s 22.4s

docker driver with containerd runtime

+----------------+----------+---------------------+
|    COMMAND     | MINIKUBE | MINIKUBE (PR 11240) |
+----------------+----------+---------------------+
| minikube start | 44.8s    | 44.3s               |
| enable ingress |          |                     |
+----------------+----------+---------------------+

Times for minikube start: 44.2s 46.8s 44.7s 44.5s 43.5s
Times for minikube (PR 11240) start: 43.4s 43.1s 48.2s 43.5s 43.4s

@andriyDev
Copy link
Contributor Author

Rebased onto master.

@medyagh
Copy link
Member

medyagh commented May 5, 2021

/retest-this-please

1 similar comment
@medyagh
Copy link
Member

medyagh commented May 5, 2021

/retest-this-please

@andriyDev
Copy link
Contributor Author

andriyDev commented May 5, 2021

Rebased onto master x2.

@andriyDev
Copy link
Contributor Author

Rebased onto master x3.

@minikube-pr-bot
Copy link

kvm2 driver with docker runtime

+----------------+----------+---------------------+
|    COMMAND     | MINIKUBE | MINIKUBE (PR 11240) |
+----------------+----------+---------------------+
| minikube start | 54.0s    | 51.5s               |
| enable ingress | 38.8s    | 38.5s               |
+----------------+----------+---------------------+

Times for minikube start: 58.5s 52.2s 52.9s 50.1s 56.2s
Times for minikube (PR 11240) start: 52.6s 47.1s 52.5s 53.6s 51.5s

Times for minikube ingress: 41.8s 36.8s 36.8s 42.3s 36.2s
Times for minikube (PR 11240) ingress: 35.7s 35.7s 42.3s 35.3s 43.2s

docker driver with docker runtime

+----------------+----------+---------------------+
|    COMMAND     | MINIKUBE | MINIKUBE (PR 11240) |
+----------------+----------+---------------------+
| minikube start | 22.6s    | 22.2s               |
| enable ingress | 33.2s    | 32.4s               |
+----------------+----------+---------------------+

Times for minikube ingress: 33.5s 33.5s 33.5s 32.5s 33.0s
Times for minikube (PR 11240) ingress: 33.0s 35.5s 27.5s 30.5s 35.5s

Times for minikube start: 23.4s 22.3s 23.0s 22.5s 21.7s
Times for minikube (PR 11240) start: 22.2s 22.7s 22.2s 21.5s 22.6s

docker driver with containerd runtime

+----------------+----------+---------------------+
|    COMMAND     | MINIKUBE | MINIKUBE (PR 11240) |
+----------------+----------+---------------------+
| minikube start | 42.4s    | 45.8s               |
| enable ingress |          |                     |
+----------------+----------+---------------------+

Times for minikube start: 32.4s 43.1s 43.8s 43.2s 49.3s
Times for minikube (PR 11240) start: 47.1s 47.6s 43.4s 47.1s 43.6s

@minikube-pr-bot
Copy link

kvm2 driver with docker runtime

+----------------+----------+---------------------+
|    COMMAND     | MINIKUBE | MINIKUBE (PR 11240) |
+----------------+----------+---------------------+
| minikube start | 50.1s    | 52.2s               |
| enable ingress | 34.8s    | 39.2s               |
+----------------+----------+---------------------+

Times for minikube start: 52.2s 49.2s 51.1s 45.8s 52.5s
Times for minikube (PR 11240) start: 50.0s 51.5s 50.2s 54.8s 54.6s

Times for minikube (PR 11240) ingress: 34.2s 57.2s 34.2s 34.7s 35.9s
Times for minikube ingress: 33.8s 34.8s 36.3s 33.8s 35.2s

docker driver with docker runtime

+----------------+----------+---------------------+
|    COMMAND     | MINIKUBE | MINIKUBE (PR 11240) |
+----------------+----------+---------------------+
| minikube start | 21.8s    | 21.2s               |
| enable ingress | 38.4s    | 32.4s               |
+----------------+----------+---------------------+

Times for minikube ingress: 34.0s 29.5s 54.0s 43.5s 31.0s
Times for minikube (PR 11240) ingress: 30.0s 31.5s 40.5s 31.5s 28.4s

Times for minikube start: 22.1s 21.1s 21.8s 21.9s 22.0s
Times for minikube (PR 11240) start: 21.4s 21.8s 21.0s 21.3s 20.5s

docker driver with containerd runtime

+----------------+----------+---------------------+
|    COMMAND     | MINIKUBE | MINIKUBE (PR 11240) |
+----------------+----------+---------------------+
| minikube start | 45.9s    | 43.8s               |
| enable ingress |          |                     |
+----------------+----------+---------------------+

Times for minikube (PR 11240) start: 43.3s 42.3s 43.3s 47.3s 42.7s
Times for minikube start: 48.3s 47.4s 47.4s 43.5s 42.6s

@minikube-pr-bot
Copy link

kvm2 driver with docker runtime

+----------------+----------+---------------------+
|    COMMAND     | MINIKUBE | MINIKUBE (PR 11240) |
+----------------+----------+---------------------+
| minikube start | 49.2s    | 50.2s               |
| enable ingress | 42.2s    | 41.5s               |
+----------------+----------+---------------------+

Times for minikube start: 47.8s 49.9s 51.1s 46.4s 50.9s
Times for minikube (PR 11240) start: 51.2s 51.3s 49.1s 52.2s 47.1s

Times for minikube ingress: 43.3s 43.8s 43.2s 35.7s 44.7s
Times for minikube (PR 11240) ingress: 37.7s 43.7s 43.7s 43.3s 39.3s

docker driver with docker runtime

+----------------+----------+---------------------+
|    COMMAND     | MINIKUBE | MINIKUBE (PR 11240) |
+----------------+----------+---------------------+
| minikube start | 21.5s    | 21.4s               |
| enable ingress | 35.7s    | 33.8s               |
+----------------+----------+---------------------+

Times for minikube start: 22.6s 21.6s 21.5s 21.0s 21.2s
Times for minikube (PR 11240) start: 21.3s 21.6s 21.5s 21.3s 21.6s

Times for minikube ingress: 37.0s 33.5s 37.0s 33.0s 38.0s
Times for minikube (PR 11240) ingress: 33.5s 32.5s 37.0s 33.5s 32.5s

docker driver with containerd runtime

+----------------+----------+---------------------+
|    COMMAND     | MINIKUBE | MINIKUBE (PR 11240) |
+----------------+----------+---------------------+
| minikube start | 45.1s    | 44.9s               |
| enable ingress |          |                     |
+----------------+----------+---------------------+

Times for minikube start: 44.0s 47.2s 43.9s 47.3s 43.0s
Times for minikube (PR 11240) start: 43.7s 47.1s 43.2s 46.9s 43.8s

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: andriyDev, medyagh

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 6, 2021
@medyagh
Copy link
Member

medyagh commented May 6, 2021

Looks good to me , Thank you for this PR and improving minikube,

@medyagh medyagh merged commit 681d4ba into kubernetes:master May 6, 2021
@andriyDev andriyDev deleted the LogsFile branch May 6, 2021 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add --file flag to minikube logs.
7 participants