Skip to content

minikube logs not outputing to file when using --last-start-only #19931

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

Closed
mattisafur opened this issue Nov 10, 2024 · 8 comments · May be fixed by #20138
Closed

minikube logs not outputing to file when using --last-start-only #19931

mattisafur opened this issue Nov 10, 2024 · 8 comments · May be fixed by #20138
Labels
lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.

Comments

@mattisafur
Copy link

What Happened?

When running minikube logs --file log.txt --last-start-only output is printer to the terminal and an empty file is created.

output of minikube logs --file log.txt --last-start-only --alsologtostderr:

I1110 17:39:34.383805   16647 out.go:345] Setting OutFile to fd 1 ...
I1110 17:39:34.383994   16647 out.go:358] Setting ErrFile to fd 2...
I1110 17:39:34.384149   16647 root.go:338] Updating PATH: /home/<username>/.minikube/bin
I1110 17:39:34.392920   16647 out.go:177]

I1110 17:39:34.400630   16647 out.go:177] ==> Last Start <==
==> Last Start <==
I1110 17:39:34.419332   16647 out.go:177] Log file created at: 2024/11/10 17:12:27
Running on machine: <hostname>
Binary: Built with gc go1.22.5 for linux/amd64
Log line format: [IWEF]mmdd hh:mm:ss.uuuuuu threadid file:line] msg
I1110 17:12:27.286943   16010 out.go:345] Setting OutFile to fd 1 ...
I1110 17:12:27.287120   16010 out.go:358] Setting ErrFile to fd 2...
I1110 17:12:27.287271   16010 root.go:338] Updating PATH: /home/<username>/.minikube/bin

Log file created at: 2024/11/10 17:12:27
Running on machine: <hostname>
Binary: Built with gc go1.22.5 for linux/amd64
Log line format: [IWEF]mmdd hh:mm:ss.uuuuuu threadid file:line] msg
I1110 17:12:27.286943   16010 out.go:345] Setting OutFile to fd 1 ...
I1110 17:12:27.287120   16010 out.go:358] Setting ErrFile to fd 2...
I1110 17:12:27.287271   16010 root.go:338] Updating PATH: /home/<username>/.minikube/bin

Tested on Ubuntu running on WSL with docker driver.

output of minikube version:

minikube version: v1.34.0
commit: 210b148df93a80eb872ecbeb7e35281b3c582c61

Attach the log file

Log file is not attached as the file does not contain any information about the logs command.

Operating System

Ubuntu

Driver

Docker

@Ritikaa96
Copy link

In my case the --last-start-only addition end up giving empty file.
with minikube logs -f=log.txt i can see logs being added there.

@mattisafur
Copy link
Author

mattisafur commented Dec 11, 2024

with minikube logs -f=log.txt i can see logs being added there.

couldn't quite get what you mean, -f is a shorthand for --follow. I'm guessing you mean --file=filename? in that case I agree, the issue is only present if --last-start-only is added, though I still haven't checked it with other flags added.

I suspect it's just just an issue with --last-start-only overriding the --file flag and causing the output to still go to stdout instead of a file. I'll have to check the code to verify that, but I don't have the time for it at the moment...

@Ritikaa96
Copy link

Hi @mattisafur Just for reference, this is the implementation of the flag --last-start-only: https://github.com/kubernetes/minikube/blob/master/cmd/minikube/cmd/logs.go#L80
If i find something regarding over-riding the --file flag i'll inform here

@mattisafur
Copy link
Author

mattisafur commented Dec 17, 2024

I looked at the implementation. at the moment it does the following (when --file is set):

flowchart

A{--last-start-only set?} --> |true| B[print start log to stdout]
A --> |false| C
C{--audit set?} --> |true| D[print audit log to stdout]
C --> |false| E[print both audit log and last start log to file]
Loading

It makes more sense to me that will will work based on these rules:

  • if --file <filepath> is specified, output to file instead of stdout
  • if --audit is specified, output only the audit log
  • if --last-start-only is specified, output only the last-start log

(handle a case where both --audit and --last-start-only are specified? maybe just output nothing?)

I'll make a PR for this change.

mattisafur added a commit to mattisafur/minikube that referenced this issue Dec 20, 2024
mattisafur added a commit to mattisafur/minikube that referenced this issue Jan 7, 2025
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Mar 17, 2025
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle rotten
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Apr 16, 2025
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue with /reopen
  • Mark this issue as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close not-planned

@k8s-ci-robot k8s-ci-robot closed this as not planned Won't fix, can't repro, duplicate, stale May 16, 2025
@k8s-ci-robot
Copy link
Contributor

@k8s-triage-robot: Closing this issue, marking it as "Not Planned".

In response to this:

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue with /reopen
  • Mark this issue as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close not-planned

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-sigs/prow repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy